|
more insight,
there may be compiler settings that are not allowing this. In other projects that i've worked with, there is no problem with what appears above (in 6.0 or Studio 2005).
|
|
|
|
|
The prototype changed between VC6 and VS2005
ON_MESSAGE( WM_MYMESSAGE, OnMyMessage )<br />
LRESULT CMyWnd::OnMyMessage( WPARAM wParam, LPARAM lParam ) <br />
|
|
|
|
|
In addition to the other comments, I happen to think this is a GOOD change. I've had to fly from India to Northern Ireland to fix a bug I made my using the wrong prototype for a message handler. The casts in the MFC macros hid my mistake during compilation, and it took me ages to track down the stack corruption.
I took the hint as was paranoid from then on - but anything a compiler can do to stop me making dumb mistakes and fine by me.
Iain.
|
|
|
|
|
COOL
Never Change My Goal!
|
|
|
|
|
Hmm, so how do I make that mistake? Haven't been to Ireland yet.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
I saw you've solved this, but just for the record:
The fact that message handlers for messages sent to windows returns an LRESULT is not new or changed in any way since VC6, this has always been the case. Have a look at MSDN[^].
The difference between VS2005 and VC6 is that in the later version you'll get a compiler error whereas the older version simply ignores it, which will put the developer in trouble later on.
Just like Iain I made this infamous error many years ago which corrupted my stack as well.
My point is that if you encounter other MFC applications with user defined message handlers mapped with ON_MESSAGE or ON_REGISTERED_MESSAGE that does not return an LRESULT , correct it immediately and save you a lot of future trouble.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Hi,
I am using the Browse For Folder dialog to allow selection of an existing folder or the creation of new folder. When the user clicks the Make New Folder button the tree allows the creation of the folder but doesn't return the folder name so that it can be shown in the status text control.
How can I detect the closing of the edit control and get the new folder path?
Thanks
|
|
|
|
|
What about the lpfn member (of the BROWSEINFO structure)?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
I know how to use the lpfn function pointer, but I am not sure what you are suggesting. I am setting that pointer to my callback function, but it is not being called when the user is doneediting the folder name.
|
|
|
|
|
Royce Fickling wrote: I am setting that pointer to my callback function, but it is not being called...
Is it being called for anything? I would have thought a TVN_ENDLABELEDIT notification would be sent.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
No, it is being called with the BFFM_INITIALIZED and BFFM_SELCHANGED messages and nothing else. I thought maybe I needed to set another flag, but I don't know what it might be.
|
|
|
|
|
I do not see any other ones here that look promising.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Good day, i'm having a proplem with a static library i'm creating. But before i'll go into the details of the library i'm gonna give you some details about the app that is importing it.
But basicly this is a raw exe. All standard libraries such as the default C Runtime Libraries are not included. Which means i have to declare my own entrypoint for the application which looks like this.
#pragma comment(lib, "SkyNet_RTL.lib")
#include <windows.h>
#include "SkyNetLoader.h"
#include "..\SkyNet_RTL\SkyNet_RTL.h"
void __stdcall __SkyNetLoaderEntry()
{
_SkyNet_RTL_INIT();
int entry_ret = 1;
ExitProcess(entry_ret);
}
</windows.h>
The only libraries that link with the application is kernel32.dll and ntdll.dll which actually link to all applications.
Don't know if it matters but that standard calling convention for the exe is __stdcall and __cdecl for the static library.
The function _SkyNet_RTL_INIT(); is a function implemented in the static library called SkyNet_RTL.dir (Skynet Runtime library). As you see i've included the SkyNet_RTL.lib in the pragma comment directive so it should be linked into the build.
The header file for the static lib IS the same file for both the application and the static library.
The Compiler puts the .lib file and the export file into the folder containing the .exe so it should be present for the linker to grab.
The static lib project is a dependency for the application so if there are any changes to the lib it's rebuilt and put into the application project's folder for linking before the application itself is built.
Here's the header file for the static library
#ifndef __SKYNET_RUNTIME_LIBRARY_V01
#define __SKYNET_RUNTIME_LIBRARY_V01
bool __cdecl _SkyNet_RTL_INIT(void);
#endif
Plain and simple. _SkyNet_RTL_INIT(void) is implemented in SkyNet_RTL.cpp like this
#include "SkyNet_RTL.h"
bool __cdecl _SkyNet_RTL_INIT(void)
{
return true;
}
The static library is also a completely raw library, which excludes all standard libraries for linking (CRT, etc). But right now the symbols dont seem to be exported. I've messed around with the settings alot and i constantly get.
SkyNet Loader error LNK2019: unresolved external symbol "bool __cdecl _SkyNet_RTL_INIT(void)" (?_SkyNet_RTL_INIT@@YA_NXZ) referenced in function "void __stdcall __SkyNetLoaderEntry(void)" (?__SkyNetLoaderEntry@@YGXXZ)
Atm i dont see anything wrong, i've gone trough quick articles on static libraries and none seem to do anything other then what i'm doing here excluding the fact that my lib and app are completely raw (my compiler/linker settings have been modified alot, no RunTime checks, etc).
The lib and export files are present for the application to be linked with.
If someone can point me in the right direction it would be greatly appreciated, and btw if you are wondering why the explicit __cdecl in the library function it was because i thought perhaps the calling conventions could change something, it was originally made __stdcall by the compiler even though the standard calling convention for this build is __cdecl.
|
|
|
|
|
Problem solved. Somehow building the lib in debug mode seems to screws up the export mechanism. No problem when the static lib is built in release.
|
|
|
|
|
Hi all
I am trying to write all my datas from my VC++ application to excel sheet.I wrote the code using c++.But the datas written in the excel sheet was not up to the expectation.
Can anyone suggest me a better way of writing the excel sheet from application.If possible with an exampl....
Thanks
gany
|
|
|
|
|
C++ Typelib tuto : http://www.codeproject.com/KB/wtl/WTLExcel.aspx
PS: You can made it without WTL, with minor modification...
A++
...
|
|
|
|
|
HI i m using visual studio 6.0 , not vc++.net
Rather i want to write a excel file....
|
|
|
|
|
If i remember effectively #import don't work with vc6 but there's an other way to generate typelib header... try "Ole/Com viewer" or MIDL in command line... i Don't remember exactely it's to old... or ask to some one that have VC7 or higher version and the same excel version to generate header for you (i use Office 2003 but it must be compatible with newer version), h file is store on : C:\Documents and Settings\xxxxxxx\Local Settings\Temp
This method allow you to made what you want with excel : read write xls file (without displaying excel interface), integrated excel on your application like ie made when you open an excel file on the web...
If you want to read or write file that can be read or write by excel the easy way is the csv file format...
A++
...
|
|
|
|
|
See here.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
hi there,
i'm trying to get the window handle from the only window, when my windows is locked. it has the "Computer Locked" title, so first i tried FindWindow(NULL, "Computer Locked"), but nothing. then i tried GetWindow(GetDesktopWindow(), GW_HWNDFIRST), because it's the (hopefully) one and only active window on the locked screen. but nothing. and i also tried WindowFromPoint with the mid point of my screen, because the "computer locked" window is centered an the screen. but no luck at all.
sooo, anyone an idea or hint, how to get this _hard to get_ window handle?
regards
ps: google is also not giving any useful results
|
|
|
|
|
I would try using Spy++, which comes with visual studio (at least it did - I assume it still does with newer stuff than I have), and see if you can find your desired window.
Maybe it has a special window class name you can look for?
And even if it is the only application you can see, I bet there are a loads of top level windows you can't see. Most tray apps will have an invisible one for getting messages at the very least.
Iain.
|
|
|
|
|
Hi Iain,
How can we use SPY++ after the computer screen in locked??
Can you please elaborate.. I tried to get the window handle but no success
Thanks!!
Regards,
Sandip.
|
|
|
|
|
Krzysztof Gorgolewski wrote: ...so first i tried FindWindow(NULL, "Computer Locked"), but nothing.
What does that function return? If NULL , have you tried calling GetLastError() ? Are you sure that is the exact name of the window being sought?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Krzysztof Gorgolewski wrote: i'm trying to get the window handle from the only window, when my windows is locked.
So you want to get a handle to the window that is displayed when the user session is locked...
Why?
In order to do what?
From a technical aspect I doubt this is even possible, but here are my thoughts...
From that screen you can switch user through "Fast User Switching", which means that you create or active another desktop. This suggests to me that this window doesn't even belong to the session your application is running in and this is probably also why ::FindWindow() cannot find the window.
If you want to know when the session gets locked you can register for session notifications with WTSRegisterSessionNotification() and process the WM_WTSSESSION_CHANGE message.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
You pretty much don't. The security screen is on a different desktop (read up on Windows Desktop objects) which is completely inaccessible to normal code.
|
|
|
|