delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/03/23/23:14:02

From: drs AT inxpress DOT net (DRS)
Subject: Windows API's [was: Re: Stupid stupid question :/ ]
23 Mar 1997 23:14:02 -0800 :
Sender: daemon AT cygnus DOT com
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <33361675.63DA.cygnus.gnu-win32@inxpress.net>
References: <199703232153 DOT NAA04193 AT www DOT aeinc DOT com>
Reply-To: drs AT inxpress DOT net
X-Mailer: Mozilla 3.01Gold (Win95; I)
MIME-Version: 1.0
Original-To: "A. Phillip Smith" <asmith AT www DOT aeinc DOT com>
Original-CC: gnu-win32 AT cygnus DOT com
Original-Sender: owner-gnu-win32 AT cygnus DOT com

A. Phillip Smith wrote:

[earlier stuff ommitted ...]
>... I merely stated a point
> of fact that the mere INCLUSION of a particular Win32 call caused the
> GUI portion of a program to apparently fail (silent death). Note that
> the code was NEVER invoked, as I stated, so usage errors are not at
> issue.

I would have to see this to believe it.

> This is further complicted on Windows NT by the fact that unless you strip
> the executable, the binary will not run. Hence you have no VCC++ debugging OR
> gdb debugging capability.

I can't comment since I'm running win95. On my system GDB works. Yes,
it's 
not much of a debugger--but that has nothing to do with the quality of
the
compiled code.

> Compile it per the gcc line. It works fine. Now uncomment the statement
> containing the GetFullPathName call, and rebuild. If you get something
> other than the "silent death" behaviour, please share it. This seems like
> a bug to me, unless there's some other link options of which I'm unaware...

The code you posted failed to work as expected, Phillip, because you 
are not using it correctly. What you posted works exactly as advertized
by the SDK. The API puts the path and the file-name together. That's it.
It does not verify the presence of the file name. It is not a "search" 
api at all. Granted, this is a pretty stupid behaviour, but then I'm not 
an MS apologist. The API in question works correctly and compiles
correctly
under gnu-win32. You simply don't know how to use it.

BTW, perhaps you were not aware, my reply was not to the list, but to
you. This
was to save you embarassment. The fact that you replied to the
mailing-list
anyway does not inspire confidence. 

--DRS

> 
> #include <windows.h>
> 
> /*
> gcc -o mytest.exe mytest.c -lkernel32 -luser32 -Wl,--subsystem,windows
> */
> 
> int STDCALL
> WinMain (HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmd, int nShow)
> {
>         HWND    hWnd;
>         LPTSTR  lpPart;
>         char    Path[255];
>         char    *cwd;
> 
>         hWnd = GetTopWindow( NULL );
> 
>         // Build path from current directory
>         cwd = (char *) getcwd(NULL, 256);
>         sprintf(Path,"Path is %s/test.exe",cwd);
> 
>         // Use Win32 search API to get the path

This is not a "search API." It does not validate the presence of the
file.

>         //if ( ! GetFullPathName("test.exe", 256, Path, &lpPart) ) {
>         //MessageBox (NULL, "Not Found", "Full Path", MB_OK|MB_ICONEXCLAMATION);
>         //}
> 
>         // Show the constructed path
>         MessageBox (NULL, Path, "Full Path", MB_OK|MB_ICONINFORMATION);
> 
>         return 0;
> }
-
For help on using this list, send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019