<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Was macht die Zeile (*StrProc) (szText) ; ??]]></title><description><![CDATA[<p>Hallo Zusammen,</p>
<p>vielleicht kann mir Jemand ja helfen. Ich suche die Bedeutung der oben genannten Zeile in folgendem Programm. Ziel ist es eine DLL aufzurufen und einen String zurück zu erhalten.</p>
<p>Würde mich freuen, wenn ich an der Ecke weiterkommen würde. Vielen Dank vorab.</p>
<p>Viele Grüsse</p>
<p>Oliver</p>
<pre><code>[cpp]
#include &lt;windows.h&gt;

long FAR WINAPI WndProc (HWND, WORD, WORD, LONG) ;

FARPROC StrProc ;    // COBOL function
HANDLE      hlib ;                               // library handle

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
                    LPSTR lpszCmdParam, int nCmdShow)
   {
   static char szAppName[] = &quot;HelloWin&quot; ;
   HWND        hwnd ;
   MSG         msg ;
   WNDCLASS    wndclass ;

   if (!hPrevInstance)
       {
       wndclass.style         = CS_HREDRAW | CS_VREDRAW ;
       wndclass.lpfnWndProc   = (WNDPROC)WndProc;
       wndclass.cbClsExtra    = 0 ;
       wndclass.cbWndExtra    = 0 ;
       wndclass.hInstance     = hInstance ;
       wndclass.hIcon         = LoadIcon (NULL, IDI_APPLICATION) ;
       wndclass.hCursor       = LoadCursor(NULL, IDC_ARROW) ;
       wndclass.hbrBackground = GetStockObject (WHITE_BRUSH) ;
       wndclass.lpszMenuName  = NULL ;
       wndclass.lpszClassName = szAppName ;

       RegisterClass (&amp;wndclass) ;
       }

   hwnd = CreateWindow (szAppName,
                        &quot;C and COBOL DLL demo&quot;,
                        WS_OVERLAPPEDWINDOW,
                        CW_USEDEFAULT,
                        CW_USEDEFAULT,
                        CW_USEDEFAULT,
                        CW_USEDEFAULT,
                        NULL,
                        NULL,
                        hInstance,
                        NULL) ;

   ShowWindow (hwnd, nCmdShow) ;
   UpdateWindow (hwnd) ;

   while (GetMessage (&amp;msg, NULL, 0, 0))
       {
       TranslateMessage (&amp;msg) ;
       DispatchMessage (&amp;msg) ;
       }
   return msg.wParam ;
   }

long FAR WINAPI WndProc (HWND hwnd, WORD message, WORD wParam, LONG lParam)
   {
   HDC         hdc ;
   PAINTSTRUCT ps ;
   RECT        rect ;
   char        szText[255];

   switch (message)
       {
       case WM_CREATE :
           hlib = LoadLibrary (&quot;WINDLL.DLL&quot;) ;
           return 0 ;

       case WM_PAINT :         // call COBOL to get strings to display
           hdc = BeginPaint (hwnd, &amp;ps) ;
           GetClientRect (hwnd, &amp;rect) ;
           rect.bottom = rect.bottom / 3 ;
           StrProc = GetProcAddress (hlib, &quot;GETSTR1&quot;) ;
           (*StrProc) (szText) ;
           DrawText (hdc, szText, -1, &amp;rect,
                     DT_SINGLELINE | DT_CENTER | DT_BOTTOM) ;
           rect.bottom = rect.bottom * 2 ;
           StrProc = GetProcAddress (hlib, &quot;GETSTR2&quot;) ;
           [b](*StrProc) (szText) ; [/b]
           DrawText (hdc, szText, -1, &amp;rect,
                     DT_SINGLELINE | DT_CENTER | DT_BOTTOM) ;
           EndPaint (hwnd, &amp;ps) ;
           return 0 ;

       case WM_DESTROY            
           FreeLibrary (hlib) ;
           PostQuitMessage (0) ;
           return 0 ;
       }

   return DefWindowProc (hwnd, message, wParam, lParam) ;
   }
</code></pre>
<p>[/cpp]</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/114878/was-macht-die-zeile-strproc-sztext</link><generator>RSS for Node</generator><lastBuildDate>Thu, 02 Jul 2026 07:15:55 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/114878.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 08 Jul 2005 14:23:29 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Was macht die Zeile (*StrProc) (szText) ; ?? on Fri, 08 Jul 2005 14:23:29 GMT]]></title><description><![CDATA[<p>Hallo Zusammen,</p>
<p>vielleicht kann mir Jemand ja helfen. Ich suche die Bedeutung der oben genannten Zeile in folgendem Programm. Ziel ist es eine DLL aufzurufen und einen String zurück zu erhalten.</p>
<p>Würde mich freuen, wenn ich an der Ecke weiterkommen würde. Vielen Dank vorab.</p>
<p>Viele Grüsse</p>
<p>Oliver</p>
<pre><code>[cpp]
#include &lt;windows.h&gt;

long FAR WINAPI WndProc (HWND, WORD, WORD, LONG) ;

FARPROC StrProc ;    // COBOL function
HANDLE      hlib ;                               // library handle

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
                    LPSTR lpszCmdParam, int nCmdShow)
   {
   static char szAppName[] = &quot;HelloWin&quot; ;
   HWND        hwnd ;
   MSG         msg ;
   WNDCLASS    wndclass ;

   if (!hPrevInstance)
       {
       wndclass.style         = CS_HREDRAW | CS_VREDRAW ;
       wndclass.lpfnWndProc   = (WNDPROC)WndProc;
       wndclass.cbClsExtra    = 0 ;
       wndclass.cbWndExtra    = 0 ;
       wndclass.hInstance     = hInstance ;
       wndclass.hIcon         = LoadIcon (NULL, IDI_APPLICATION) ;
       wndclass.hCursor       = LoadCursor(NULL, IDC_ARROW) ;
       wndclass.hbrBackground = GetStockObject (WHITE_BRUSH) ;
       wndclass.lpszMenuName  = NULL ;
       wndclass.lpszClassName = szAppName ;

       RegisterClass (&amp;wndclass) ;
       }

   hwnd = CreateWindow (szAppName,
                        &quot;C and COBOL DLL demo&quot;,
                        WS_OVERLAPPEDWINDOW,
                        CW_USEDEFAULT,
                        CW_USEDEFAULT,
                        CW_USEDEFAULT,
                        CW_USEDEFAULT,
                        NULL,
                        NULL,
                        hInstance,
                        NULL) ;

   ShowWindow (hwnd, nCmdShow) ;
   UpdateWindow (hwnd) ;

   while (GetMessage (&amp;msg, NULL, 0, 0))
       {
       TranslateMessage (&amp;msg) ;
       DispatchMessage (&amp;msg) ;
       }
   return msg.wParam ;
   }

long FAR WINAPI WndProc (HWND hwnd, WORD message, WORD wParam, LONG lParam)
   {
   HDC         hdc ;
   PAINTSTRUCT ps ;
   RECT        rect ;
   char        szText[255];

   switch (message)
       {
       case WM_CREATE :
           hlib = LoadLibrary (&quot;WINDLL.DLL&quot;) ;
           return 0 ;

       case WM_PAINT :         // call COBOL to get strings to display
           hdc = BeginPaint (hwnd, &amp;ps) ;
           GetClientRect (hwnd, &amp;rect) ;
           rect.bottom = rect.bottom / 3 ;
           StrProc = GetProcAddress (hlib, &quot;GETSTR1&quot;) ;
           (*StrProc) (szText) ;
           DrawText (hdc, szText, -1, &amp;rect,
                     DT_SINGLELINE | DT_CENTER | DT_BOTTOM) ;
           rect.bottom = rect.bottom * 2 ;
           StrProc = GetProcAddress (hlib, &quot;GETSTR2&quot;) ;
           [b](*StrProc) (szText) ; [/b]
           DrawText (hdc, szText, -1, &amp;rect,
                     DT_SINGLELINE | DT_CENTER | DT_BOTTOM) ;
           EndPaint (hwnd, &amp;ps) ;
           return 0 ;

       case WM_DESTROY            
           FreeLibrary (hlib) ;
           PostQuitMessage (0) ;
           return 0 ;
       }

   return DefWindowProc (hwnd, message, wParam, lParam) ;
   }
</code></pre>
<p>[/cpp]</p>
]]></description><link>https://www.c-plusplus.net/forum/post/826725</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/826725</guid><dc:creator><![CDATA[oj0169]]></dc:creator><pubDate>Fri, 08 Jul 2005 14:23:29 GMT</pubDate></item><item><title><![CDATA[Reply to Was macht die Zeile (*StrProc) (szText) ; ?? on Fri, 08 Jul 2005 14:31:28 GMT]]></title><description><![CDATA[<p>StrProc(szText);</p>
]]></description><link>https://www.c-plusplus.net/forum/post/826730</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/826730</guid><dc:creator><![CDATA[besser so]]></dc:creator><pubDate>Fri, 08 Jul 2005 14:31:28 GMT</pubDate></item><item><title><![CDATA[Reply to Was macht die Zeile (*StrProc) (szText) ; ?? on Fri, 08 Jul 2005 14:31:35 GMT]]></title><description><![CDATA[<p>StrProc ist ein Zeiger auf eine Funktion.</p>
<pre><code class="language-cpp">StrProc = GetProcAddress (hlib, &quot;GETSTR1&quot;) ;
</code></pre>
<p>der Zeiger wird auf eine aus einer DLL entnommenen Funktion namens GETSTR1 gesetzt. Mit (*StrProc)(szText) wird dieser Zeiger dann dereferenziert und die dahinterliegende Funktion aufgerufen. Das kann man übrigens auch einfacher haben, indem man</p>
<pre><code class="language-cpp">StrProc(szText)
</code></pre>
<p>schreibt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/826731</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/826731</guid><dc:creator><![CDATA[Bashar]]></dc:creator><pubDate>Fri, 08 Jul 2005 14:31:35 GMT</pubDate></item><item><title><![CDATA[Reply to Was macht die Zeile (*StrProc) (szText) ; ?? on Fri, 08 Jul 2005 14:33:00 GMT]]></title><description><![CDATA[<p>du solltest vielleicht mal</p>
<p>FARPROC StrProc ;</p>
<p>in einen vernünftigen funktionszeiger umwandeln.</p>
<p>mit FARPROC kann man nichts anfangen. wundert mich das dein beispiel geht</p>
]]></description><link>https://www.c-plusplus.net/forum/post/826736</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/826736</guid><dc:creator><![CDATA[farproc]]></dc:creator><pubDate>Fri, 08 Jul 2005 14:33:00 GMT</pubDate></item><item><title><![CDATA[Reply to Was macht die Zeile (*StrProc) (szText) ; ?? on Fri, 08 Jul 2005 16:13:36 GMT]]></title><description><![CDATA[<p>Hallo Zusammen,</p>
<p>Danke für die Antworten. Also: Mein Beispiel geht gar nicht und mich wundert dann auch nicht mehr warum nicht. Das Beispiel stammt aus dem Netz und ist ein Sample der Firma MicroFocus. Ich werde Eure Tips mal umsetzen und versuche es dann noch einmal. Also ein Funktionszeiger ist das hier ... Na, da bin ich gespannt.</p>
<p>Viele Grüsse</p>
<p>Oliver</p>
]]></description><link>https://www.c-plusplus.net/forum/post/826794</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/826794</guid><dc:creator><![CDATA[oj0169]]></dc:creator><pubDate>Fri, 08 Jul 2005 16:13:36 GMT</pubDate></item></channel></rss>