|
Hi,
thanks for reply.
I am new to databases,so i am not able to implement your suggestion into code.
I am sending my present code .It will be of great help,if you show me direction from here.
CString sDriver;
sDriver = _T("MICROSOFT ACCESS DRIVER (*.mdb)");
CString sDsn;
sDsn.Format(_T("ODBC;DRIVER={%s};DSN='';DBQ=%s"),sDriver,sInstallDir + _T("\\v010\\Program\\MDD.mdb"));
if(!m_pDatabase->IsOpen())
{
m_pDatabase->Open(NULL,FALSE,FALSE,sDsn);
}
.............................................................
//HERE I NEED THE CODE TO CHECK WHETHER THE DATABASE HAS ANY TABLES ,IF YES ,I NEED TO DELETE THOSE TABLES.
..............................................................
I DON'T KNOW HOW TO GET CONNECTION OBJECT HERE BECAUSE I DON'T FIND ANYTHING LIKE CONNECTION OBJECT WHILE USING ODBC,CDATABASE AND CRECORDSET CLASS.
....................................................................
ANY HELP WILL BE GREATLY APPRICIATED.
..........................................
THANKS AND REGARDS.
|
|
|
|
|
I've been looking for some s/code for a flowchart control.
I'd like to present some data as a flowchart, or as Frontpage does it's Hyperlink view, or as family tree data is presented.
Anyone know of any s/code for this type of presentation ?
ScorpioMidget
|
|
|
|
|
I'm writing an program with VC1.5 .In this application,It first read some files to some lists. The user can modify the data in some dialogs. when application closed,rewrite the list data to its files.
But now have a bug.Sometimes,when the application startup, the user find the data are lossed .but when close the applicaiton and startup again,the data are readed right!
why?
|
|
|
|
|
Hi!
For Ctrl key we use GetKeyState(VK_CONTROL)<0.
How can we detect the Alt key? What is the WORD value of Alt key?
Thanks,
Sovann
|
|
|
|
|
VK_MENU
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
How can I programatically detect the network cable capacity and type using winsock or winapi?
for example I want to learn the capacity and type of transmission line between two peer which they reside in the same physicall network.
Altay Karakuş
karanba
|
|
|
|
|
In my dialog based application i am not using new/delete at all. Still in debug mode after i close the dialog, the debug window gives folwing error:
Detected memory leaks!
Dumping objects ->
{44} normal block at 0x00BB2638, 33 bytes long.
Data: < C > 00 43 00 CD CD CD CD CD CD CD CD CD CD CD CD CD
{43} normal block at 0x00BB25D0, 40 bytes long.
Data: < |L > 14 7C 4C 10 16 00 00 00 00 00 00 00 00 00 00 00
Object dump complete.
How can i find out that where this error is originating. When i double click these lines in debug window, nothing happens.
Imtiaz
|
|
|
|
|
Try out Numega Boundschecker. Fully automated.
Good tools.
Or manually in your codes. Place in CMemoryState to get the allocated bytes for in the codes to see the before and afterso that you know which part is leaking. A bit tedious but at least it is free. (Come with MFC)
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
I load one graphic file (jpeg) into picture control (picture control 1) using CImage with code image.Load(); and then by using .setbitmap((HBITMAP)image) to bind it into picture control.
I need to cut a portion of this image, I am using this code:
hdcDest = ::GetDC( CpThis->m_CpDest->GetSafeHwnd() );
hdcSrc = ::GetDC( CpThis->m_CpSource->GetSafeHwnd() );
::SelectObject( hdcSrc, CpThis->m_BackSurface.hBmp );
::StretchBlt(hdcDest,0,0,300,400,hdcSrc,pointlx,pointly,cutwidth,cutheight,SRCCOPY);
::DeleteDC( hdcSrc );
::ReleaseDC( CpThis->m_CpDest->GetSafeHwnd(), hdcDest );
and it work, the result will be display into picture control 2.
The problem here are it is not bind it into picture control, It just use picture control as an frame to display it and how to save it into a file (result.jpg).
Any body have the idea to solve this problem, I really appreciate it.
Thanks you.
|
|
|
|
|
hi,
i met a problem that my application got access violation exception. i know where it happen. apart from prevent this exception happen, any method to catch this exception? i tried to catch CException. but, can't try it.
any help?
thanks,
jim
|
|
|
|
|
I'm not 100% sure on this, but I think you need to use __try /__except to catch hardware faults or GPFs. try /catch are only for C++ exceptions.
--Mike--
Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
Latest art~!@#2rDFA#@(#*%$Rfa39f3fqwf--=
NO CARRIER
|
|
|
|
|
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.
|
|
|
|
|