|
I am a VC++ freshman, pls help me! Thanx a lot!!
How can I derive a MFC class from CMenu thus I can use Message Reflection ?
"Insert" Menu -> "New Class"
but I cannot see CMenu (and many other classes) in the "Base Class" edit control!!!!!
To be or not to be!
|
|
|
|
|
You could select CObject from the list, then when the class is created replace all CObject references with CMenu.
Otherwise generate a generic class based on CMenu and do all the message stuffs manually.
Ant.
|
|
|
|
|
Thanx for you attention!
but it doesn't work.
1. No CObject in the Base Class list either.
2. What I want to do is using Message Reflection in my derived calss. If I choose generic class,I cannot use Class Wizard to add Message Reflection. I tried to derive from CStatic (or others),then replaced, but I got an error as follow:
error C2039: 'messageMap' : is not a member of 'CMenu'.
if no massagemap, how can I use Message Reflecion???
To be or not to be!
|
|
|
|
|
if no massagemap, how can I use Message Reflecion???
Quite, sorry the class has to be derived from CWnd in order to use message maps and reflection macros.
Ant.
|
|
|
|
|
God bless me!
I wanted to write a neat owner-draw menu class that can process WM_MEASUREITEM & WM_DRAWITEM in itselt, but.....
Must I give up???
I add a virtual func. MeasureItem()to my menu class, but it doesnot work with the menu item opened a submenu, why??
To be or not to be!
|
|
|
|
|
I have a DLL file that contains all the functions required to interact with a USB hardware interface device. There is also a corresponding header file which I got from the device manufacturer. I include the header file in my MFC application and put the DLL file in the debug folder of my project. But still I get compile error saying that it doesn't know anything about those functions I used from the DLL file. After some more research I think I need a .lib file and that I should link it to the project . Using an already compiled DLL seems not as straight forward to me and so I'd really appreciate your kind help.
I'm beginning to know that I don't know.
|
|
|
|
|
Yes you will need the .lib file and the .h file in order to use the fuctions in the DLL, this is by all means the easiest way.
Without either of these you can prototype all functions you use and use LoadLibrary() to load the corresponding DLL.
Ant.
|
|
|
|
|
Don't use static linking, use dynamic loading of the dll functions like this:
typedef bool (*t_pFunc1)(LPCTSTR Param1, long Param2, bool Param3, ....);
t_pFunc1 m_pfFunc1;
HINSTANCE m_hLibraryInstance;
//Load dll library
m_hLibraryInstance = ::LoadLibrary(_T("Sample.dll"));
//load function
m_pfFunc1 = (t_pFunc1)::GETFUNCADDRESS(m_hLibraryInstance,"Func1");
//Dll call
m_pfFuncDll(param1, param2, param3, ... );
were rgrtgrtvrtrt rtrtb brt tyuhjghj hbhbnh hnjm 1234567?
|
|
|
|
|
Thank you guys. I stumbled upon some article that will guide me through linking it to the project.
|
|
|
|
|
Can I load dll library from other computer in LAN, using:
HINSTANCE LoadLibrary(LPCTSTR lpLibFileName);
were rgrtgrtvrtrt rtrtb brt tyuhjghj hbhbnh hnjm 1234567?
|
|
|
|
|
The best way to answer that is to just try it. If LoadLibrary() fails, call GetLastError() to find out why.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
If you use a UNC path you should be able to, as long as your programming is running under a user context that has access to the network share.
For instance:
HINSTANCE h = ::LoadLibray(_T("\\\\Computer\\Share\\MyDLL.dll"));
Note that if you are running under some weird user context (e.g., the System account) you might not have access to the network at all, in which case you certainly won't be able to load the DLL.
Sometimes I feel like I'm a USB printer in a parallel universe.
|
|
|
|
|
I'm working with a video framgrabber in Windows and having trouble getting access to pixel-level information. I have found solutions to access the card through high-level Windows API (Video capture window) and then save the image as a .bmp, but this requires too much turn around time. Idealy I'd like to open the card and make direct calls that return the digitized video signal as pixels in an array. Any help or direction would be appreciated.
Flea
|
|
|
|
|
How do I find if the machine is idle for more than 10 mins
from my VC++ program
Jack
|
|
|
|
|
|
I have a project with the base name "Shelf2".
Is there a straightforward way to rename everying in it to "Shelf3" for example. I have though of using find and replace in files but not sure if that would catch everything.
Ta.
Elaine
The tigress is here
|
|
|
|
|
Depending on how often you need to reuse the code it may be just as easy to set up an appwizard. VC.NET minimised the custom appwizard nightmare from VC6. It takes a while to get them right but it's not too bad.
Extracting the common code to a shared library first made the job a lot smaller.
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
Trollslayer wrote:
I have though of using find and replace in files but not sure if that would catch everything.
I have done this many times with VC6 projects. I load all the text files including project files and clw files into EditPad[^] and do a find and replace on all loaded documents. Then I have to rename all the files to match.
[EDIT]
I have also used the following tool in the past but I am not sure it renames everything: http://www.codeproject.com/tools/vsrename.asp?target=rename%7Cproject#xx774298xx[^]
[/EDIT]
John
|
|
|
|
|
|
Your welcome. And being a Monday I surely could use the hug.
John
|
|
|
|
|
Hi!,
I am developing a container for embedding Miscosoft Word documents.
I am using CoCreateInstance()to create object,
after creation I set the clientsite and with the help of IPersistInterface::Load I load the storage, at this moment a temporary file having extension .doc is created in the Temp folder.
I want to avoid the creation of the temporary .doc file in the Temp folder.
and I also want to know the reason as to why the temporary .doc file is created.
Thanks
Anshuman
|
|
|
|
|
Probably Word creating it for its own purposes, for example to keep a working copy on disk for auto-recovery. You can't do anything about it, don't worry about it.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
I have a file that contains the following datas:
-2363824.109 (x position)
4870666.240 (y position)
2.18 (speed)
I want to read from this file either just the x position, either the y position, either the speed.
I did the following:
int main(int argc, char *argv[]){<br />
<br />
ifstream GPSFile;
GPSFile.open("C:\\My Files\\GPSFile\\GPSFile.txt", ios::in);
double CataCoordX, CataCoordY;<br />
double gpsx=0, gpsy=0;<br />
while (!GPSFile.eof()){
if (GPSFile.rdstate() == ios::failbit){cout<<"ERROR, \n";}<br />
GPSFile >> gpsx;
GPSFile >> gpsy;
CataCoordX=gpsx;
CataCoordY=gpsy;
}
cout << CataCoordX <<endl;<br />
cout << CataCoordY <<endl;<br />
GPSFile.close();<br />
return 0;<br />
}
This will print :
2.18
4.87067e+006
But me i want to print the first and the secon value. How to do this?
THX
|
|
|
|
|
YOU HAVE GOT A PROBLEM IN THE while LOOP.
I have stripped down ur while loop for simplicity;)
The Problem(step by step):
while (!GPSFile.eof()){<br />
GPSFile >> gpsx;<br />
GPSFile >> gpsy;<br />
}
In the first time it loops, x-value is copied into gpsx and y-value is copied into gpsy. BUT you havent reached end of file yet, SO the while loop is executed again and this time, the value of speed is copied into gspx (thats the ERROR!!!)
So erronous output is
2.8
4.87067e+006
SOLUTION
Solution 1:
while (!GPSFile.eof()){<br />
if (GPSFile.rdstate() == ios::failbit){cout<<"ERROR, \n";}<br />
GPSFile >> gpsx;<br />
GPSFile >> gpsy;<br />
break; :rose:<br />
}
CataCoordX=gpsx;<br />
CataCoordY=gpsy;
Solution 2:
while (!GPSFile.eof()){<br />
if (GPSFile.rdstate() == ios::failbit){cout<<"ERROR, \n";}<br />
GPSFile >> gpsx;<br />
GPSFile >> gpsy;<br />
GPSFile >> gpspeed;
CataCoordX=gpsx;<br />
CataCoordY=gpsy;<br />
}
PROBLEM SOLVED
Remember... testing & debugging are always part of programming ...so exterminate those stinking bugs
...avenger
|
|
|
|
|
Thx a lot, I really thought i will get no answer to my silly queston.
Though is there a method that will allow me to read no matter what line of the text file, without being obliged to read all the file? I mean like positioning the "cursor" to a certain position and read from there?
What I mean is if I have a bigger file as:
-2363824.109 (x position)
4870666.240 (y position)
2.18 (speed)
4566888.0035 (z position)
58.6544 (something)
269.2 (something)
And i if i want to retrieve for example the 3rd line. Is there a simple solution?
THX
|
|
|
|