|
Say that you have created a new dialog based project, and included some OCX as an object in that dialog.
Is there any way to override the OCX's OnPaint()?
Thanks,
David
|
|
|
|
|
VC++ .NET 2003 supports the typename keyword. However, by all appearances this keyword is superfluous. The compiler "knows" whether a reference object is a type (else my code in question wouldn't have compiled with the previous compiler.)
So can anyone, in plain english explain why typename really is needed (aside from making the compiler ISO compatible)?
|
|
|
|
|
Supposedly, it helps the compiler spot errors before instantiation time. Follow this link[^] for a particularly pathological example (I guess all examples with regard to this subject are pathological anyway).
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Now I have been assigned a task to do a FDD test. During the project I don't know how to make the Floppy-Disk-Device's LED blinking. Could you tell me some solutions to it, please.
Thank you!
LeonOrient
|
|
|
|
|
I don't think you can make that LED just blink. I don't see a reason why that LED would be accessed through software. Just try to open a file that doesn't exist in the floppy drive and make sure that you don't have any floppy disks in it and that way you might make it blink.
CFile aFile;
aFile.Open( "a:\\NoName.txt", CFile::modeRead );
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
Alough there is a bug, the solution is still a good way.
Thanks!
Can we make Floppy-Disk-Dervice' LED to blink by
adopting the "DeviceIoControl"? This is just my thought.
Who can tell me a better way and its realization?
3Ks!
LeonOrient
|
|
|
|
|
I can use this command line "exefilename.exe -? >>a.txt" in Windows command prompt to store the parameter information into a.txt. But when I use WinExec to execute this command in my program, it doesn't work. neither does ShellExecute.
The only thing it does is displaying the parameter info in the command prompt terminal (I can see the prompt flashing).
Thank you to help me!
|
|
|
|
|
Well, the program itself isn't the one doing the redirecting, it's the "cmd" (NT bases systems) or "command" (95 bases boxes) program that does the redirecting. So, if you want to do it, you can do it like this:
TCHAR a_szCommandLine[512] = {0};
_stprintf( a_szCommandLine, _T("cmd.exe /c \"exefilename.exe -? > a.txt\"") );
WinExec( a_szCommandLine, SW_HIDE );
Chris Richardson Terrain Software
|
|
|
|
|
|
I am building an sdi app with a static splitter. I want to add a command so that when the user selects it from the menu, some controls are enabled in one of the views.
To accomplish this I manually added member variables to refer to the controls in the view class for one of the split windows. However, if I add a member variable using the GUI of vs.net, I can only add it to the original view class (that mfc appwizard created). How can I get the GUI to add them to my new view classes?
Thanks!
|
|
|
|
|
Don't - why would you want to ? Open the file and add them manually, as you say you have done.
Christian
NO MATTER HOW MUCH BIG IS THE WORD SIZE ,THE DATA MUCT BE TRANSPORTED INTO THE CPU. - Vinod Sharma
Anonymous wrote:
OK. I read a c++ book. Or...a bit of it anyway. I'm sick of that evil looking console window.
I think you are a good candidate for Visual Basic. - Nemanja Trifunovic
|
|
|
|
|
Well, i have no use for the original view class anymore... though I don't really understand what happens to it when one uses a static splitter (sometimes when I resize the window and it flickers, it seems like the old view is still under there?). I am just curious how the GUI decides where to put the member variable, if it determines it from the code or if it is just some obscure setting somewhere that it set when the appwizard generates the project.
|
|
|
|
|
I really need example code to help me with accessing a control that is in a dialog bar from the main window. I have not found any examples or tutorials on the internet.
-- Steve
|
|
|
|
|
How can I get the my program "Tray Icon position" in Desktop window without any clicking message from icon?
|
|
|
|
|
|
Does anyone out there have any information about how to mix a MFC EXE that uses CString with a DLL that uses ATL CString?
They are related but won't link together as-is.
Any clues or news out there?
P.S. I am not looking for alternatives to CString, but am looking for information about how to make these slightly different CString's talk to each other.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
Santa Cruz Networks
|
|
|
|
|
For completeness, I'll share what I've learned.
Though first, I'll say, that everytime I think MS is getting their act together, you run into to something totally weird...
If your MFC program wants to call a DLL that uses CString in it's API's -- they will only work if the DLL is MFC too. ATL CString will screw it up with name clashes....
I fixed my problems by using AtlCString -- which the ATL CString is a typedef of.
there's no documentation for this at all.....
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
Santa Cruz Networks
|
|
|
|
|
This isn't specific to visual C++, but hopefully someone can help me anyways
I have a vector full of objects... I wish to sort this vector by the return value of one of the object's methods.
IE
----
vector<dog> dogs;
//load vector with random dogs...
----
I wish to sort the dogs by their age, int dog.get_age();
Is there a simple way to do this?
Thanks!
Greg
|
|
|
|
|
You could simply use a map with the key the dog's age and that's that. Or for a vector use the sort algorithm: sort( dog.begin(), dog.end() ). You'll need to read up on sort().
Note that there is an STL/ATL/WTL message board which you should have used.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Greg23234 wrote:
I have a vector full of objects... I wish to sort this vector by the return value of one of the object's methods.
You might want to have a look at the documentation for the std::sort that takes a predicate, where your predicate is something like
bool predicate(const dog& a, const dog& b)
{
return a.fn() < b.fn();
}
|
|
|
|
|
Okay I understand that in the regular C++, programs start at main() and run thru each line until it finishes. And that in MFC everything is controled by a message map. So If I want to run a function, without an event calling it like for a button, then I need to create a message map and call it.....right?
I mean why can't there be an easier way to call a function outside of events.
So my problem is that I've read the docs on messaging on CP and went thru the steps but every time I create a message map I get and error unresolved external symbol. Am I missing something?
My issue is this. I want to have me main dialog window come up. Then I want a function to run. My problem is that my function runs first then the main dialog window comes up. So how can I by pass this?
Is there an easier way of doing this?
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Tom Wright wrote:
So If I want to run a function, without an event calling it like for a button, then I need to create a message map and call it.....right?
No not right. If your function is not an event handler, then y do u need to use message maps for it? u can simply call it like any other function in C++.
Tom Wright wrote:
My problem is that my function runs first then the main dialog window comes up. So how can I by pass this?
To make sure that your dialog comes up first and your function is called next. Call your function in InitDialog() function after the call of base class InitDialog function call,instead of constructor for CDialog.
cheers
Muhammad Shoaib Khan
http://geocities.com/lansolution
|
|
|
|
|
Sorry I didn't mention that I am calling my function in the OnInitDialog() function, but my main windows still does not come up because it won't until after it hits the return TRUE.
Thanks anyway
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Sorry I didn't mention that I am calling my function in the OnInitDialog() function, but my main windows still does not come up because it won't until after it hits the return TRUE except that it hits my function call first.
Thanks anyway
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Where do you call this function? If you call it from OnInitDialog() then it will be executed before your dialog shows up. Post a message (WM_APP+number) at the end of OnInitDialog() to your app and do all your initialization in the event-handler of the WM_APP-message. This message will be received by your app directly after the dialog shows up.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|