|
Thanks a lot, but my application hasn't Windows, it's only a Process on Memory, can I use FindWindow() to send the message WM_CLOSE ?
|
|
|
|
|
Hello, does anyone have experience using MySql and its C++Interface?
my problem is:
every time I try to fill a database using MySql++ the MySql-Server shuts down after a while. What is it due to ?
The Connection-Pointers are destroyed after Filling a record, so there should not be a "Too Many Connections"-Problem.
Versions:
MySql 3.23.42-nt,
mysql++-1.7.1-1-win32-vc++
|
|
|
|
|
Hi, all,
I want to print a snapshot of the activated window, I'v written some codes.
It works well if the printer is directly connected the computer, but if it
outputs to a network printer, it doesn't work, a paper is exported from the
printer, but nothing on it.
here is the code:
void CBaseTabSheet::OnFilePrint()
{
// TODO: Add your command handler code here
CRect rectWindow;
CWnd *pWnd;
CDC memDC;
if (GetParent()->IsZoomed()) {
pWnd = AfxGetMainWnd();
AfxGetMainWnd()->GetWindowRect(rectWindow);
} else {
pWnd = GetParent();
GetParent()->GetWindowRect(rectWindow);
}
CWindowDC dc(pWnd);
int nX = rectWindow.Size().cx;
int nY = rectWindow.Size().cy;
memDC.CreateCompatibleDC(&dc);
CBitmap *pBitmap = new CBitmap();
pBitmap->CreateCompatibleBitmap(&dc, nX, nY);
CBitmap * pOldBitmap = (CBitmap *)memDC.SelectObject(pBitmap);
memDC.BitBlt(0, 0, nX, nY, &dc, 0, 0, SRCCOPY);
CDC prtDC;
CPrintInfo printInfo;
DOCINFO di;
if (AfxGetApp()->GetPrinterDeviceDefaults(&printInfo.m_pPD->m_pd)) {
HDC hDC = printInfo.m_pPD->m_pd.hDC;
if (hDC == NULL) {
hDC = printInfo.m_pPD->CreatePrinterDC();
}
if (hDC != NULL) {
CString strTitle;
strTitle.LoadString(AFX_IDS_APP_TITLE);
prtDC.Attach(hDC);
memset(&di, 0, sizeof(DOCINFO));
di.cbSize = sizeof(DOCINFO);
di.lpszDocName = strTitle;
prtDC.m_bPrinting = TRUE;
if (prtDC.StartDoc(&di) != -1) {
prtDC.StartPage();
int X = prtDC.GetDeviceCaps(LOGPIXELSX);
prtDC.StretchBlt(0, 0, nX * X / 96, nY * X / 96,
&memDC, 0, 0, nX, nY, SRCCOPY);
prtDC.EndPage();
prtDC.EndDoc();
}
prtDC.Detach();
prtDC.DeleteDC();
}
}
memDC.SelectObject(pOldBitmap);
delete pBitmap;
memDC.DeleteDC();
}
Any suggestion? Thanks in advance
Vincent
|
|
|
|
|
You need to use the OpenPrinter function and then to use the StartDocPrinter and StartPagePrinter, WritePrinter functions...
Best Regards
Carlos Antollini.
www.wanakostudios.com
Sonork ID 100.10529 cantollini
|
|
|
|
|
Its probably because the printer driver does not support the BitBlt function. Convert your bitmap to a DIB and use StretchDIBBits.
You should then find it will work every time.
Roger Allen
Sonork 100.10016
If I had a quote, it would be a very good one.
|
|
|
|
|
Hi, Roger Allen,
Thank you for your reply.
Could you tell me more details about how to conver the bitmap to DIB? As you can see my codes, I created a CBitmap object and selected it to a device, and copied the screen image to it. How can I conver this CBitmap object to DIB.
Thank you very much.
Vincent
|
|
|
|
|
Hey Friends..
now i programming for my palm PC(windows CE).and there is a problem...i cannot load/place the ActivX control...looking sooo strange.but the CLSID is present in registry after registering the control......
help..................
Renjith-The CPian.
|
|
|
|
|
You are seriously confused.
Palm has exactly nothing to do with WinCE.
and even less with Visual C++
|
|
|
|
|
Anyone worked with ETSLayoutFormView?
the scrollbars does not seems to appear. I guess
SetScrollSizes(MM_TEXT, CSize(cx,cy));
in OnSize(UINT nType, int cx, int cy)
is causing the scrollbar to be made for the size of the window and not the size of the form itself.
Anyone?Thanxs in advance.
|
|
|
|
|
A while ago I posted a question about a program suddenly ceasing to load when I run it, with no error message or output or anything at all. This happened again today, and I managed (through trial and error) to track it down to the class definition.
I declared some stuff private: above my public: block in my CDialog-derived class definition. I moved the private: block down to the very bottom of the class, and once again my app starting working.
Just a tip, if you've had the same problem.
- Jason
(SonorkID 100.611)
In the beginning, teachers taught the 5 W's: who, what, where, when, why. Now it's just a big damn G
|
|
|
|
|
Hi Jason, FWIW I'm afraid I find it very hard to believe this was the cause of your problem. The simple fact the you changed something (anything) and did a rebuild was more likely the reason.
Neville Franks, Author of ED for Windows. www.getsoft.com
|
|
|
|
|
Yeah, I just tried mixing it around again, and couldn't reproduce the behaviour. Who knows :/
- Jason
(SonorkID 100.611)
In the beginning, teachers taught the 5 W's: who, what, where, when, why. Now it's just a big damn G
|
|
|
|
|
I have an program (P1) that runs a long (and unattended) process and then terminates when that process is complete.
I do not have the source code for this program and so have no way to change it's behaviour.
I can write another program that can start another process, but I need to start it when P1 has completed it's job and not before.
So I need a way of detecting when P1 has finished and use that event to start my program.
Any help here?
Paresh Solanki
hombre que trabaja pierde tempo precioso "The man who works is losing precious time." Vuemme
|
|
|
|
|
If your program launches P1, then you can use...
WaitForSingleObject(hProcess, INFINITE);
This function will not return until the created process is terminated. After P1 is done, then you can call the third program.
Jeremy L. Falcon<nobr>
Homepage : Sonork = 100.16311
"But everybody darlin' sometimes bites the hand that feeds."
"Remember in this game we call life that no one said it's fair."
"Just because you're winnin' don't mean you're the lucky ones."
Song: Breakdown - Album: Use Your Illusion II - Artist: Guns N' Roses
|
|
|
|
|
Thanks, but I have no control over when P1 runs. I just need to know when it's completed.
I cannot start P1 from within my app because I have no control over when it should start.
Paresh Solanki
hombre que trabaja pierde tempo precioso "The man who works is losing precious time." Vuemme
|
|
|
|
|
Ok, in that case you need to use the psapi.dll... look into code project, you can find a class that look in all process, if you don't find the P1 running, is because the application finished
Best Regards
Carlos Antollini.
www.wanakostudios.com
Sonork ID 100.10529 cantollini
|
|
|
|
|
Use CreateProcess() to start P1. You will get new process handle in the last parameter PROCESS_INFORMATION structure - hProcess. Then you can use this handle to wait for completion of that proces as a parameter for WaitForSingleObject() function. After call to WaitForSingleObject() will finish, you can get exit code of proces with GetExitCodeProcess(), if you will need it. Then you can start it again.
|
|
|
|
|
What Martin said is best, but you could also use FindWindow in a while loop. As soon as the window has closed, it will not be found by FindWindow so drop out of the loop.
Jason Henderson quasi-homepage articles "Like it or not, I'm right!"
|
|
|
|
|
hi,
I want to use a set of actual bits(enough of bools!) to control certain actions in my program.Is there any better or easier way than bitset template to use;any plain old C things?
-Huskey
|
|
|
|
|
|
Use a DWORD like this:
#define ACTION1 2
#define ACTION2 4
#define ACTION3 8
#define ACTION4 16
#define ACTION5 32
DWORD actions = ACTION3 | ACTION5;
if (actions & ACTION3)
...
Jason Henderson quasi-homepage articles "Like it or not, I'm right!"
|
|
|
|
|
|
hi,
I am using Cristi Posea's control bar code to display a tabbed bar.
I have some lists to be shown when the relevant tab is hit.All works fine untill I relocate the bar.The tab window gets resized but the lists inside the tab donot.How to get that working.
The tab I am using is a class derived from CTabCtrl and I have handled the WM_SIZE and WM_SIZING to relocate the lists.This works in a resizable dialog box but not in the bar.WHY? Also no style other than WS_CHILD|WS_VISIBLE|WS_BORDER get shown eg WS_EX_CLIENTEDGE.WHY?
Also,why is the rect of the bar in negatives and why the child should have
zeros while creating?
I really need some help.I want to restructure all the lists into tabs for my
on going project.
Waiting desperately.
Steven Wu.
|
|
|
|
|
I am using a callback to process wave messages (WIM_DATA, WIM_CLOSE, WOM_DONE, WOM_CLOSE). The problem is: under Windows 9x and ME everything worked great. Now, however, Windows XP locks when I free up allocated memory by calling waveOutReset() or waveInReset().
I think the problem is that the callback exists in a different thread than where the memory was allocated. If this is correct, what should I use: GlobalAlloc(), VirtualAlloc(), HeapAlloc()??? Or should I be doing something different altogether?
Johnny
|
|
|
|
|
Hey, can anyone give any recommendations of good books that I can get that will help with my COM/OLE/ATL woes? I am using COM/OLE (and/or ATL) and trying to incorporate MS Word into an application, add a toolbar button dynamically, and other processing, and I was wondering if anyone knew of any books that might be good, possibly show some examples, etc. I would like to get a couple of books that might be working with Word in them. Any ideas would be appreciated!!!
I have looked at various posts on this website and a few others and they have helped alot. But they just don't seem to work in my application and I am not sure why...
|
|
|
|