This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Windows API's [was: Re: Stupid stupid question :/ ]


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@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]