|
Thanks Mike, I should've got that one. oh well, thanks again
Luke.
|
|
|
|
|
The error says your code is calling Base::draw() but you did not provide a definition of that function. Adding virtual does no good in your case because that still doesn't provide the function definition, and anyway you are not calling draw() through a Base* variable.
--Mike--
If it doesn't move and it should: WD-40. If it moves and it shouldn't: duct tape.
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Hey thanks Mike, sorry, I'm not sure what you mean by "and anyway you are not calling draw() through a Base* variable."
I have the definition but my problem is now I add some class that extends from Base into the std::list but using
std::list<GlObject>::iterator item;
for ( item = objects.begin(); item != objects.end(); item++) {
item->draw();
}
it always executes the code in Base::draw() and not SomeOtherClass::draw() , any ideas? or more a good reference on the net that could help me out. thanks
Luke.
|
|
|
|
|
Your list is of Base objects, not pointers, so there is
no polymorphism here.
Create a list of Base pointers, and point them at some
of those other objects, or a mix or what-have-you.
|
|
|
|
|
Hi all
Can i know anywhere or anyone have visual c++ setup for me to download them..
Thanks
|
|
|
|
|
Sure, microsoft.com. The MSDN member download section.
Mind you it's probably >2GB.
|
|
|
|
|
Mike Nordell wrote:
Mind you it's probably >2GB.
And will probably cost quiet a bit!
Regards,
Brian Dela
"There should be an amendment to the constitution, that every president must be examined for paranoia before moving into office." - peterchen
|
|
|
|
|
Thanks for your help, i will be more greatful if you give me the links to the direct page of the site where i can download the software..
|
|
|
|
|
|
If you email piracy@microsoft.com, they'd love to hear from you. Be sure to tell them all the other Microsoft software you have stolen, so they take your request seriously.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
I want to use this function.I add Advapi32.lib to my project setting,and my project is MFC project so I don't need to add windows.h to it,but I got an error that this function does not exist.The editor of VC show me this function,but I don't know why it say it's undeclared identifier. Any idea?
p.s:I use windows xp pro.
Mazy
"And the carpet needs a haircut, and the spotlight looks like a prison break
And the telephone's out of cigarettes, and the balcony is on the make
And the piano has been drinking, the piano has been drinking...not me...not me-Tom Waits
|
|
|
|
|
Since this function is only supported in Windows 2000 and later, you need to make sure that the WINVER #define value is set to 0x500 or greater before you include windows.h .
Software Zen: delete this;
|
|
|
|
|
|
Hi folks, I'm trying to associated the desktop window with LRESULT CALLBACK WindowProcedure(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam;
this is what I did:
hWnd= GetDesktopWindow();
WNDCLASS desktopClass;
char className[200];
GetClassName(hWnd,className,200);
BOOL res=GetClassInfo(hInstance,className,&desktopClass);
desktopClass.lpfnWndProc=WindowProcedure;
RegisterClass(&desktopClass);
MessageBox(hWnd,className,"",MB_OK);
however the WindowProcedure was not called. why?
thanks!!
|
|
|
|
|
By calling RegisterClass you are changing that class for all subsequent calls to CreateWindow for that class.
If you want to change the wndproc for a class of a window that has already been created you will need to call ::SetClassLong and set the GCL_WNDPROC index.
Optionally if you just want to subclass one specific window you should use ::SetWindowLong and replace the wndproc for that one window with GWL_WNDPROC.
I am not sure that you will be able to do what you are trying to do unless you can get your code loaded into the same process that created the desktop window (probably explorer.exe). Because the address that you set for the wndproc will be in a different address space and will not be accessible unless it is in the same process.
Good Luck
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
you are right that I can't set GWL_WNDPROC attribute if the windowdoes not belong to the same process. This is what msdn doc says:
GWL_WNDPROC
Sets a new address for the window procedure.
Windows NT/2000/XP: You cannot change this attribute if the window does not belong to the same process as the calling thread.
so does this mean there's no way I can listen to the msg that's been send to the desktop window and respond to those msgs?
thanks a million
|
|
|
|
|
king_of_the_world wrote:
so does this mean there's no way I can listen to the msg that's been send to the desktop window and respond to those msgs?
I would not necessarily say that, because everything that I have put my mind to, I have been able to accomplish in one way or another for Win32.
However, I was looking at Spy++, and it does not allow you to recieve the messages from the Desktop window. So if you can get the messages I think that you will have to do something that is not very mainstream. I dont have any suggestions of where to start either.
Good Luck
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Ok heres's what I want to do ultimately: I want to be able to detect a mouse press down on the desktop window, and I've seen program such as a screencapture program able to do that, so it has to be possible, right? so is there a way of accomplishing that without listening to the msgs that are sent to the desktop window?
thanks!!
|
|
|
|
|
You can install a global mouse hook to listen for mouse clicks, or you can use DirectInput with a background to listen for the mouse clicks.
When you get a mouse click message use ::WindowFromPoint() to determine if the user clicked on the desktop window.
Good Luck
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
thanks, I installed a global hook and played around with it. but it doesn't work well, in particular, if I do the following, does it it put all the variables in global dll? it got lots of weird behavior from my diligently produced code(I copy and pasted below). Sometimes if I restarted my computer it seems that the hook was catching the mousedown message if i press anywhere on desktop, but sometimes it doesn't, in the best case it's crashing the system. would you provide me with some code snipet that install a mousehook and print the mouse position when the user left click the mouse?
thanks a million!
#pragma data_seg(".IdleTrac") // you must define as SHARED in .def
HHOOK mouseHook,keyboardHook;
HINSTANCE g_hinstance;
#pragma data_seg()
#pragma comment(linker, "/section:.IdleTrac,rws")
LRESULT CALLBACK KeyboardProc(int nCode, WPARAM wParam, LPARAM lparam){
switch(wParam){
case 27:
UnhookWindowsHookEx(mouseHook);
UnhookWindowsHookEx(keyboardHook);
errstream.close();
PostQuitMessage(0);
}
return 0;
}
LRESULT CALLBACK MouseProc(int nCode, WPARAM wParam, LPARAM lparam){
// MessageBox(hWnd,"in mouse proc ","",MB_OK);
MOUSEHOOKSTRUCT* mousehook=(MOUSEHOOKSTRUCT*)lparam;
POINT p=mousehook->pt;
switch(wParam){
case WM_LBUTTONDOWN:
MessageBox(hWnd,"leftt button down","",MB_OK);
// errstream<<"mouse position is "<
|
|
|
|
|
Hello
I want to build tools in MS office (eg. Acrobat Icon that appear in MS Office after install Acrobat Writer) but I don't know how and I should use which language(my teacher advise me to use ActiveX or VBA or VC++),please help me ...very thanks
|
|
|
|
|
I don't know if this will be much help but you might look at using COM. I had to incorporate MS Word into an application and put a special button on the Word toolbar. It isn't easy if you are a beginner but it is possible. There are several good examples out there, Amit Dey has one that is really good. If you haven't already looked around, you might start by looking here:
http://www.codeproject.com/com/#Automation
If all depends on how much you know and how much you want to know....
|
|
|
|
|
Hi There,
I have a class derrived from a CComboBox class, and I really need to recieve notification - SelEndOK for example, but from what I can make out messages are transmitted to the parent window, and a derrived class doesn't recieve the any kind of notification. Is there any way to recieve get these messages?
Any help would be much appreciated...
With time we live, with money we spend!
Joel Holdsworth.
|
|
|
|
|
Use the ON_CONTROL_REFLECT macro in your message map to handle the notifications in the CComboBox -derived class.
--Mike--
If it doesn't move and it should: WD-40. If it moves and it shouldn't: duct tape.
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Heyo, (english version ... when u can call it is attached as reply)
Ich versuche im Moment in einer EXE-Datei einen Import zu verändern, dass klappt ganz gut und wunderbar, wenn diese Funktion aus der EXE-Datei heraus aufgerufen wird.
Sobald ich dies aber bei einer anderen EXE-Datei machen möchte, bei der ich in den Prozess eingeschleust werde - über ein WH_CBT - funktioniert dies jedoch nicht, da die DLLs zu diesem Zeitpunkt noch nicht initialisiert wurden.
Da bereits in der win_main der veränderte Import benutzt werden soll kann ich auf keine anderen Hooks zurückgreifen.
Weis jemand wie ich An die Initialisierte Importtable komme, bevor diese benutzt wird ?
Vielen Dank schonmal
Also, ich setze einen CBT Hook:
(innerhalb der DLL die in den Zielprocess reinmuss)
<br />
LRESULT CALLBACK CBTProc(int nCode,WPARAM wParam,LPARAM lParam) {<br />
return CallNextHookEx(CBThook,nCode,wParam,lParam) ;<br />
} ;<br />
<br />
void WINAPI InstallNCT(void) {<br />
GWMhook = SetWindowsHookEx(WH_CBT,&CBTProc,GetModuleHandle("MYDLL.dll"),NULL );<br />
} ;<br />
Dieser Code wird mit der ProzessID des Launchers ausgeführt. Sobald ein neuer Prozess erstellt/aktiviert ist wird der folgende Code durchgeführt:
<br />
BOOL APIENTRY DllMain( HANDLE hModule, <br />
DWORD ul_reason_for_call, <br />
LPVOID lpReserved<br />
)<br />
{<br />
switch (ul_reason_for_call)<br />
{<br />
case DLL_PROCESS_ATTACH:<br />
if (isZielProzess()) {<br />
HMODULE thismod = GetModuleHandle("MYDLL.dll") ;<br />
LPVOID addr = GetProcAddress(thismod,"MyOverrideFunction") ;<br />
ChangeImport_("D3DDrv.dll","DDRAW.dll","FunctionName",addr) ;<br />
} ;<br />
return TRUE ;<br />
case DLL_THREAD_ATTACH:<br />
case DLL_THREAD_DETACH:<br />
case DLL_PROCESS_DETACH:<br />
break;<br />
}<br />
return TRUE;<br />
} ;<br />
Wobei ChangeImport_(ModulName,ImportModulName,ImportFunctionName,Addresse) ;
in der MudulName.dll den Import aus der ImportModulName.Dll mit dem Namen ImportFunctionName mit der Addresse überschreibt.
Nun funzt das nicht, da die D3DDrv nich initialisiert ist... aber ich brauchs funzent
|
|
|
|
|