|
Typically it might be because of the use of a NULL pointer.
Why don't you look it to the condition that creates this exception?
|
|
|
|
|
Exactly, do ASSERT in the codes.
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
actually, i don't know exactly the problem.
it occur sometimes. it is a serial commu. application. i think it related to overlapped IO problem.
|
|
|
|
|
Hi there,
i would like to include a dropdown arrow on my toolbar, but ive failed to get the procedure to do it.Does any one know it and he helps me,iam badly in need of it and i will be gratefull for your help.
Kea
More Blessed to Share Ideas than to do alone
|
|
|
|
|
I hope I understand your question. Do you want a new Icon in the toolbar.Yes? So,I only have an idea for "Microsoft Visual C++". In this case you can draw a new icon for the toolbar in the resources. And you must modified the *.rc file with an text editor (close your work area in Visual C++). Add the ID of your new icon at the right position
<br />
IDR_MAINFRAME TOOLBAR DISCARDABLE 16, 15<br />
BEGIN<br />
BUTTON ID_FILE_NEW<br />
BUTTON ID_FILE_OPEN<br />
BUTTON ID_FILE_SAVE<br />
BUTTON ID_NEW_ICON<br />
BUTTON ID_APP_ABOUT<br />
END
|
|
|
|
|
No Nuehli,i dont want an icon on my toolbar but just a dropdown arrow like those you see on may be on MSword toolbar, they are not icons.
thanks for more advise.
kea
|
|
|
|
|
Hello,
I have a CDialogBar with many run-time-generated progress bar windows on it. I would like to know when the user clicks on one of these progress bars but after trying many message map entries, I cannot seem to find the right way to funnel these messages to any function of mine.
I've tried to simply intercept the ON_WM_LBUTTONDOWN message, but it is only called if the user clicks in the dialog bar EXCEPT for in my progress bar windows.
Any ideas/help?
thanks!
JennyP
|
|
|
|
|
Sounds like you have to handle the message within the progress bars, not in the CDialogBar.
Cheers,
Fredrik
"Felix qui potuit rerum cognoscere causas."
|
|
|
|
|
Thanks for the reply. Can this 'clicked' message be reflected back from the CProgressBar to the CDialogBar in which it exists? I'd really love to handle it in the dialog class instead of the progress bar class.
thanks!
JennyP
|
|
|
|
|
Should work. See TN062 in MSDN.
Cheers,
Fredrik
"Felix qui potuit rerum cognoscere causas."
|
|
|
|
|
I need to find out how to open\write to a file and then close it. I just need to record the time at point 1 to the file and the record the second point 2 time. I have the time variable in one variable. Please and I will be very thankful for your help.
[It is possible to represent everything in this universe by using 0 and 1]
I'm going to live forever or die trying.
|
|
|
|
|
If you use MFC, you can use the CFile Class.Open,Close or Write Class Members are there. If you want a File Dialog you can use CFileDialog. Also there is the CStdioFile Class.
CStdioFile CalFile("YourFileName.dat",CFile::modeCreate | CFile::modeWrite | CFile::typeText );<br />
CalFile.WriteString(Time1.Format("%H,%M,%S"));
CalFile.WriteString("\n");
CalFile.WriteString(Time2.Format("%H,%M,%S"));<br />
CalFile.Close();
|
|
|
|
|
I'm new to programming.I received some code: the aim is that the commands are send with the socket-method, and then execute a console program, using the pipe-method. The code is rather long, so here is the fragment with the fault. I tried the following code : (with the aim to find the entire string that I typed in 'char kk', so I could compare it with another string like "help" or "howlong"...)
//////
{
long lEvent=WSAGETSELECTEVENT(lParam);
UINT r;
static char buf[MAXRECVBUF];
DWORD dwNumberOfBytesWrite;
SOCKET sock_tmp;
if (lEvent==FD_ACCEPT){
// "Accept" handler
SOCKADDR_IN clientAddr;
int nClientAddrLen=sizeof(clientAddr);
// Accept connection
if ((sock_tmp=accept(sock_listen,(LPSOCKADDR)&clientAddr,&nClientAddrLen))==INVALID_SOCKET){
if (WSAGetLastError()!=WSAEWOULDBLOCK) return;
}
if (NowUsing==TRUE){
closesocket(sock_tmp);
return;
}
sock=sock_tmp;
send(sock,BANNER,strlen(BANNER),0);
NowUsing=TRUE;
// Boot shell program
sa.nLength = sizeof(sa);
sa.bInheritHandle = TRUE;
sa.lpSecurityDescriptor = NULL;
CreatePipe(&hPipeOutputRead,&hPipeOutputWrite,&sa,5000);
CreatePipe(&hPipeInputRead,&hPipeInputWrite,&sa,5000);
memset((void *)&si,0,sizeof(si));
memset((void *)&pi,0,sizeof(pi));
si.cb = sizeof(si);
si.dwFlags = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES;
si.wShowWindow = SW_SHOW;
si.hStdInput = hPipeInputRead;
si.hStdOutput = hPipeOutputWrite;
si.hStdError = hPipeOutputWrite;
CreateProcess (NULL,SHELL_NAME,NULL,NULL,TRUE,0,NULL,START_DIR,&si,&pi);
CloseHandle(hPipeOutputWrite);
CloseHandle(hPipeInputRead);
// Create character read&send thread
hThread_out = CreateThread(NULL,0,OutputToSocket ,NULL,0,&dwChildThreadIdOut);
return;
}else if (lEvent==FD_CLOSE){
// "Close" handler
closesocket(sock);
TerminateProcess(pi.hProcess,0);
TerminateThread(hThread_out,0);
CloseHandle(pi.hProcess);
CloseHandle(hPipeOutputRead);
CloseHandle(hPipeInputWrite);
NowUsing=FALSE;
return;
}
/////start problem-code//////
// Recv packet from client and write to SERVER.EXE
if ((r=recv(sock,(LPSTR)buf,MAXRECVBUF,0))==SOCKET_ERROR) {return;}
kk[i]=buf[0];
kk[i+1]='\0';
MessageBox(NULL,kk,"speciale functie uploaden en zo",MB_OK);
i=i+1;
WriteFile(hPipeInputWrite,&buf,r,&dwNumberOfBytesWrite,NULL);
/////end problem-code//////
}
/////
But now the messagebox always returns:
when I type the 1st character: the first character
when I type the 2nd character: the first character is now a trash character and the second is the character I typed
when I type the 3rd character: the first two character's are now trash character's and the third is the character I typed
...
What should I do so that I can find only the string I typed in "kk", without the trash??
|
|
|
|
|
Hi,
In my app I have to put some bitmamps in RichEditCtrls as Ole Objects. I load the bitmaps at the start of the application and I use OleCreateFromFile to create the object from the bitmap file.
The problem that I have is there are too many images (over 25) and the loading process takes about 7 seconds. If I load them in the main thread, the applications seems dead. You can't move the window, can't minimize it...
I tried to load the images in a separate thread but with the same code the OleCreateFromFile returns an error: "The system cannot find the specified file" altough if I make an fopen in the same thread I can read that file.
Do you know something about this? Am I doing something wrong?
Thanks
-----
We are what we repeatedly do. Excellence, then, is not an act, but a habit.
|
|
|
|
|
I have a QUESTION!
I'd just finished building a simple program.
All the while it works..
and now suddenly when i compile it.. no errors and no warnings..
but after i Build it...its ok...everythings fine..
But when i EXECUTE it (Ctrl+F5)..
nothing happened!!
it didnt load at all..no warnings...no errors...just didnt load like it used to!!!
can anyone help me?
thanks
-thong-
twh81@tm.net.my
...
|
|
|
|
|
colormyiris wrote:
can anyone help me?
Use F5 instead of Ctrl+F5.;)
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Does it not load, or does it load, run and close so quickly you can't see it? I've sometimes found this when there is an error in the initialisation code that causes the application to close before it does anything.
Hopes this helps,
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Is there a way in MFC to control the background color of each item in a listbox. I've seen some custom controls that will do it but I would just like to use the standard listbox.
|
|
|
|
|
No, not without doing an ownerdraw listbox. There are examples here on CP.
HPS HwndSpy - GUI developer's aid to visually
locate and inspect windows. For the month of August
only, use coupon code CP-81239 for 30% off.
|
|
|
|
|
Hi,
Thank you for checking out my post.
I am writing a simple CPropertySheet (with property pages of course) VC++ 6 Doc/View application, and I want to change the look of the OK or CANCEL buttons.
Trouble is that I don't seem to be able to create a control variable of either buttons. The buttons are provided by the framework I am thinking, but does anyone know how to access them?
The only interaction I have with the Cancel or OK buttons is to check the return value when dlg.DoModal() returns and that is it.
Thanks for any suggestions.
Michael
|
|
|
|
|
In the property sheet class, you can call GetDlgItem(IDOK) to get a CWnd* on the OK button. Change IDOK to IDCANCEL for the Cancel button.
--Mike--
Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
Latest art~!@#2rDFA#@(#*%$Rfa39f3fqwf--=
NO CARRIER
|
|
|
|
|
Hi Mike,
Thank you so much for replying. I seem to recognize your name...I think you have kindly helped me in the past.
Anyway, I did try GetDlgItem(ID_OK) before I posted my question and I couldn't get it to work. It must be the way I did it. It would compile ok but crash on running when doing the check "ASSERT(::IsWindow(m_hWnd));". Here's the code I used within my CPropertySheet class's constructor :-
CMyPropertySheet::CMyPropertySheet(LPCTSTR pszCaption,
CWnd* pParentWnd, UINT iSelectPage)
:CPropertySheet(pszCaption, pParentWnd, iSelectPage)
{
//add each page to the propert sheet
this->AddPage(&this->m_prop_page1);
//get pointer to OK button so I can alter it
CButton * pbutton = (CButton *)this->GetDlgItem(IDOK);
}
Actually, as I write this I realize that maybe the propertySheet is not a window (and that includes the OK button) until I run "property_sheet_obj.DoModal()", so that might be the problem right there. Do I have to alter the OK button after the DoModal().....I will try that.
Thanks Mike and thank you all for any suggestions or confirmation.
Michael
|
|
|
|
|
No windows are created until after DoModal(), so it might be easiest to do the change in the first page that gets shown:
CPropertySheet* pSheet = (CPropertySheet*) GetParent();
CWnd* pOKBtn = pSheet->GetDlgItem(IDOK);
pOKBtn->SetWindowText ( _T("'Aight") );
--Mike--
Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
Latest art~!@#2rDFA#@(#*%$Rfa39f3fqwf--=
NO CARRIER
|
|
|
|
|
|
I'm about to create a Word like replacement for my self, Word doesn't have CD-R burning features/XML format/Templates (HTML)/portiblility from comp to comp that i need so I'm going to make a replacement. Possibly if it is built right I'll sell copies. To start out how should I CFormView or CRichEdit?
Also I'm courious about how to include an Intelisense Like feature in a RichEdit/Edit box.
-Steven Hicks
CPACodeProjectAddict
|
|
|
|