|
Hi All
Does anyone know how to change the background color of common dialogs like CFileDialog, CPrintDlg etc...
Best Regards
Sundar
|
|
|
|
|
Add this to your InitInstance() , it will change default color of all dialogs in the application:
SetDialogBkColor(RGB(0xFF, 0, 0), RGB(0, 0xFF, 0xFF));
ARSALAN MALIK
|
|
|
|
|
how to display book mark of a page on html help?
is string in this way?
"c:\\my.chm::\\thepage.htm#themark"?????
includeh10
|
|
|
|
|
I have created a generic class (not derived from CWnd).
When I call one function in that class I like it to generate a call to another member function of the same class after about 3 seconds. Tips on how to accomplish that?
Thanks / Anders
_____________________________
...and justice for all
APe
|
|
|
|
|
VOID CALLBACK TimerProc( HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime )<br />
{ <br />
AfxMessageBox("TimerProc");<br />
}<br />
<br />
<br />
bool CMyClass::Func()<br />
{<br />
SetTimer( NULL, 1, 500, TimerProc);<br />
…<br />
}
Got the following compiler error:
error C2664: 'SetTimer' : cannot convert parameter 4 from 'void (struct HWND__ *,unsigned int,unsigned long,unsigned long)' to 'void (__stdcall *)(struct HWND__ *,unsigned int,unsigned int,unsigned long)'
_____________________________
...and justice for all
APe
|
|
|
|
|
Hi,
Within the Func() function use SetTimer as
SetTimer( NULL, 1, 500, (TIMERPROC)TimerProc);
This will work
SUjan
|
|
|
|
|
What should a simple coder like me do without you?
Really Thanks!
_____________________________
...and justice for all
APe
|
|
|
|
|
First of all I must say I´m quite new to C++ and advanced programming.
I need to write an application that communicates with the serial port programming in Visual C++ .Net.
I have downloaded a number of source files from codeproject, however I cannot compile it, (guess its something wrong with my settings etc) and I´m a little confused about the number of files that come with the projects and what they do...
I was wondering if anybody had a sample program that communicates with the serial port (like only a .cpp file or two)....hm maybe it´s not even possible, but I´ll be happy for some comments on this as this serial comm is getting on my nerves
best regards
doneirik
|
|
|
|
|
|
i wish i can send you a book through the net but it is still impossible if it is in phisical paper format ... I strongly recommend you ( if you find it ) "Advanced Programming on windows" by Jeffrey Richter.
However if you arent such an adventure man and simply want to solve the problem by now, you have to find in the msdn the documentation about: CreateFile, WriteFile and ReadFile, and SetCommConfig. They are functions of windows api. Do not forget to include <windows.h>. With those four functions and a lot of error discovering efforts you will probably success in comunicating with serial port. I have done it before in my work but i dont have the code.
|
|
|
|
|
Hi,
I am developing an application where I open COM2 port for communication.The code to open the port is
HANDLE hTest;
hTest = CreateFile ("COM2",GENERIC_READ | GENERIC_WRITE , 0, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL);
if ((hTest == NULL) || (hTest == INVALID_HANDLE_VALUE))
MessageBox ("Port cannot be opened",NULL,MB_OK);
else
MessageBox ("Port cannot be opened",NULL,MB_OK);
This code is running fine when I run the code on Windows 98 or windows 2000 but when I try to run it on Windows XP, the CreateFile statement returns 0xffffff which is INVALID_HANDLE_VALUE.
Can any one tell how can i open a port on Windows XP
Rits
|
|
|
|
|
See if COM2 is in the System->Device Manager. I believe I had problems opening port4 because it wasn't listed, so I had to install some drivers.
Otherwise, no idea.
|
|
|
|
|
Also make sure nothing else is using the port. For example, a printer driver configured to use com2 could cause the create file call to fail. You should use GetLastError() for more detailed error returns.
|
|
|
|
|
Hi Paul,
You are Right.
Some other application was openiing the port and the port was not being closed.
When i close the port first, it works fine
Rits
|
|
|
|
|
How can i mix audio and video using DirectX
thanx
|
|
|
|
|
Hi programmers,
How can I rename an existing VC++ project?
|
|
|
|
|
Hi,
Think it is difficult !
Sujan
|
|
|
|
|
|
Thanks for your response.
It will be very helpfull.
|
|
|
|
|
Can you show me how to access controls of Dialog Template using in CDialogBar Class from View class(My Application is MDI). I want to change content of the control when View's modified.
Thanks a lot,
|
|
|
|
|
I have implemented drag and drop on my new aplication and i have a strange error.
In InitInstance method of app object i call AfxInitOle() function.
Lets we call source window A and target window B.
In A´s OnCreate message handler i use the following code:
medium.tymed = TYMED_FILE;
medium.lpszFileName = (unsigned short *)((LPCSTR)(new CString("TempDragDrop.dat")));
source->CacheData(((CLightControllerApp *)AfxGetApp())->ID_FOCUS_FORMAT,&medium);
In B´s OnCreate message handler i use the following code:
target.Register(this);
And on OnDestroy message handler of B window I use:
target.Revoke();
I have no idea of what is going wrong, so please help me. Many thanks to all you and sorry for my poor english.
|
|
|
|
|
i have found it, and i wish i can help anyone who finds the same problem... The cuestion is that when you call the CacheData function, you must care every value in the STGMEDIUM and FORMATETC structures. A good idea is to make something like this: ZeroMemory(pMedium, sizeof(STGMEDIUM )) and ZeroMemory(pFormatetc, sizeof(FORMATETC )) before beginning to give values to its members. You must remember too that since these two structures are passed to CacheData() they arent owned by aplication, that means for example that you can do something like this:
pMedium = new STGMEDIUM;
...;
...->CacheData(...,pMedium, ...);
...;
delete pMedium;
because this will surely cause a program´s crash.
|
|
|
|
|
i have found it, and i wish i can help anyone who finds the same problem... The cuestion is that when you call the CacheData function, you must care every value in the STGMEDIUM and FORMATETC structures. A good idea is to make something like this: ZeroMemory(pMedium, sizeof(STGMEDIUM )) and ZeroMemory(pFormatetc, sizeof(FORMATETC )) before beginning to give values to its members. You must remember too that since these two structures are passed to CacheData() they arent owned by aplication, that means for example that you can do something like this:
pMedium = new STGMEDIUM;
...;
...->CacheData(...,pMedium, ...);
...;
delete pMedium;
because this will surely cause a program´s crash.
|
|
|
|
|
I have made a sdi application in MFC.
I added a menu item, and a routine when it is clicked. That routine creates an instance of, and displays, an information dialog I created.
What I need to do though is display some information in that dialog from the loaded in document.
The biggest problem I always seem to have is finding out how to access the document in another class like my dialog class.
So I am wondering what I need to do to get a document pointer to my dialog class. Either by passing it in from MainFrm when I create the dialog, or better yet, have my dialog class itself get a pointer to the document.
Anyone have any ideas or code samples?
I notice my view class has something like:
CDXtoXDDoc* CDXtoXDView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CDXtoXDDoc)));
return (CDXtoXDDoc*)m_pDocument;
}
|
|
|
|
|
yes, i supose that you have defined the message handler of this menu item in the view class. I supose too that you call de DoModal() function of the dialog class in this message handler. Therefore your´s dialog parent window is the view window. If you call the dialogs method:
CWnd * GetParentWnd() and cast teh result to a (CDXtoXDView *). Just doing this: (CDXtoXDView *)GetParentWnd(), then you have a pointer to the view object. You just have to call GetDocument() view´s method to obtain the document pointer. This should work.;)
|
|
|
|