|
IDI_SIMLEY
AFX_IDI_STD_FRAME
I see different IDs there....which one is correct?
LoadIcon() isn't enough to set a window icon.
You need to call CWnd::SetIcon() with the loaded icon's HICON.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
IDI_SIMLEY is in the include file which goes like
#define IDI_SIMLEY 101
while AFX_IDI_STD_FRAME is in the .rc file. I am using AfxGetApp()->LoadStandardIcon in the Create ( NULL, "windows",........) function which is part of CFrameWnd.
How do I use CWnd::SetIcon in this case?
|
|
|
|
|
I'm not sure how you are using LoadStandardIcon() in CFrameWnd::Create(). None of the Create()
parameters take an HICON.
Regardless, LoadStandardIcon() loads system icons. To load an icon from your app's resources
you need to load them yourself.
Here's one way to change a window's icon after it has been created:
if (MyFrameWnd.Create(NULL, "windows",........))
{
HICON hIcon = AfxGetApp()->LoadIcon(IDI_SIMLEY);
MyFrameWnd.SetIcon(hIcon, TRUE);
}
Another method is to use a custom window class instead of the default MFC window class and
specify an HICON in that window class. A window created using that windowclass will use that
icon by default.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I have a service that runs at idle dispatch priority because it is a continuously running background process that monitors certain resources. It starts when the machine is booted and ends when the machine is shut down.
As a result of being run at idle dispatch priority it accumulates a lot of page faults. Being a background process this performance hit is not a problem but I am concerned that the page fault number will climb to a point where it may cause problems, both perceptually and possibly to processes monitoring activity.
Is there a way of resetting page fault count periodically without going through the exercise of unloading and reloading the service just to reset the counter?
|
|
|
|
|
#ifndef GLINIT_H
#define GLINIT_H
#ifdef _EXPORT
#define GLAPI __declspec(dllexport)
#else
#define GLAPI __declspec(dllimport)
#endif
GLAPI void GLInit()
{
int i;
i++;
return;
}
#endif
Can someone tell me why this is not allowed in a header? I want to simply include this header and have the includer call GLInit().
The error I get when compiling with VC 2005 is:
error C2491: 'GLInit' : definition of dllimport function not allowed
I'd like to add that there is no practical reason for me to do this, because I can simply include the function without exporting, however, I'm playing around with exporting and can't figure out the problem.
|
|
|
|
|
try this:
#ifdef _EXPORT
#define GLAPI __declspec(dllexport)
#else
#define GLAPI __declspec(dllimport)
#endif
#ifdef _EXPORT
GLAPI void GLInit()
{
int i;
i++;
return;
}
#endif
you should move your implementation to a .cpp - File or use the macro from above.
|
|
|
|
|
Yes, but what if I want to include a global function? If I were to write the function in a .cpp, I'd have to include the .cpp. I don't think the file extension makes any difference at all, but it just feels weird including a .cpp.
|
|
|
|
|
The header file should just contain the declaration (prototype) for the function.
The actual definition of the function should be moved out of the header to a single .c/.cpp file.
That c/cpp file should only be in the dll project. The header can be used in the dll project
and app projects which use the dll.
#ifndef GLINIT_H
#define GLINIT_H
#ifdef _EXPORT
#define GLAPI __declspec(dllexport)
#else
#define GLAPI __declspec(dllimport)
#endif
GLAPI void GLInit();
#endif
void GLAPI GLInit()
{
int i; <code><-- i is uninitialized!</code> :)
i++;
return;
}
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
|
I create project that has view class derive from CFromView and I put combo control on this view.
I need to AddString at the point when the main windows create.
I try to put it in WM_CREATE functine and PreCreateWindow function but I got "Assertion fail".
Please advise me,What's message function use for this issue.
|
|
|
|
|
It won't work in PreCreateWindow because the window object (HWND) for the control has not been
created yet.
Any time in OnCreate(), after the base class OnCreate() has been called, it should work
(unless you are manually creating the combobox, in which case any time after you create the
control's window).
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hello,
can anyone help me ???
I want to get listing of active com port name to be displayed for selection ... as in like that hyper-terminal where you select the com port for use. virtual com port...
what`s the command code for getting the list like directory so i can display that out for selection ???
Thanks !
|
|
|
|
|
Just for idea, you can see Teraterm terminal software for which source available at the end of its home page[^]
Best Regards,
Suman
|
|
|
|
|
What about the Win32_SerialPort WMI class?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Nameste Guruji's
I am making an app... in VC++ in which i need to open notepad and MSWord file at VC++ form , Notepad file is open but msword file not open , my code is below
void CSearch::OnButtonCal()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
WinExec("notepad.exe",SW_SHOW);
}
Its work properly
But when i try to open ms word or winword file with below code its not working properly
void CSearch::OnButtonCal()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
WinExec("winword.exe",SW_SHOW);
}
can any one told me what is mistake here.
Plz told me its correct solution as soon as possible
Regard's
Kaushik
|
|
|
|
|
Probably Winword.exe is not in the standard search path as it's an installed application. Notepad.exe lives in the Windows folder so it can always be found.
You need to add a path to the filename. e.g.
WinExec("c:\\Program Files\\Office\\winword.exe",SW_SHOW);
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Hi
i am making an application in vc++ according to client requirment we have to save .doc file in mysql database (.doc file is just copy and paste in an edit box)
I use BLOB mysql data type for that .
but when i submit form we can not save a large .doc file in data base
My question is that can i use any property or any method in vc++ for edit box so that we can save more data at a time
Please guide me in this for solving this problem
Regard's
Kaushik
|
|
|
|
|
Y_Kaushik wrote: ...we can not save a large .doc file in data base
Can you save smaller files?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi.
I add a custom control on a dialog and i invoke DoModal() to popup it but there is no reaction of it. The return value is –1. Please tell me why and how to solve it.
Microsoft Visual C++ 2005
|
|
|
|
|
Check if you did call AfxOleInit( ); before the custom control is created.
|
|
|
|
|
kibab wrote: I add a custom control on a dialog...
Also make sure the control has been properly registered.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
how to write or create an xml file in mfc. pls help me. im new to this.
|
|
|
|
|
You can use MSXML or XmlLite if you want to stick with Microsoft. Also, expat and Xerces are nice alternatives. There ate plenty of articles and examples on The Code Project and on the web in general such as http://www.perfectxml.com/CPPMSXML/20020712.asp[^].
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
I guess you need to look up msxml.dll I think they're on to msxml4.dll but we still use msxml3.dll on CE. This Dll implements objects that let you read and write xml. It contains a parser and a generator so you get the XML as a memory based structure you can access and change and then write it back to disk as XML. Multi threading support is not great but it does the job . Otherwise have a look for Sax, which I think is still the open XML parser standard. Enjoy.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Check out TinyXml, too.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|