|
Hi,
When I had a memory leak I tried GlowCode. I found the problem in a matter of minutes, its easy to use and worked really well for me.
They do a free trial for 21 days, you can download it from here I believe....
http://www.glowcode.com/eval.htm
Cheers,
Ali
|
|
|
|
|
Hi,
I am writing a serial application to communicate with an external device using RS-232. Requirement is to Write to the external device continuously and read from the device continuously. I have created a thread that performs Read based on the event EV_RXCHAR. On receiving a character i would store it in my local buffer for processing.
I have implemented the write using a 1 millisecond timer in the same thread as read.
The problem is to make this application write and read based on events.
Is it logical to put this write function in a separate thread and will my application be still able to receive Read events?
Please suggest me as to what to be done.
Regards,
Siva
|
|
|
|
|
i've load and displayed a bitmap in a view using StretchBlt. it succeed.and now, how can i print it out on paper? i really got totally blank how to start it. i can't find any samples on printing bitmap from msdn library. can anybody please tell me where i can find related codes that i can refer to. or maybe steps on how to do it. thank you
|
|
|
|
|
Hi,
a little example
PRINTDLG pd;
DOCINFO di;
int iError;
float fx, fy;
float fPixXWnd, fPixYWnd, fPixXPrint, fPixYPrint;
float fScaleX, fScaleY;
HDC ScreenHdc;
// Initialize the PRINTDLG structure.
memset(&pd, 0, sizeof(PRINTDLG));
pd.lStructSize = sizeof(PRINTDLG);
pd.lpfnPrintHook = NULL;
pd.lpfnSetupHook = NULL;
pd.Flags = /*PD_RETURNDEFAULT |*/ PD_RETURNDC;
//open the Printdialog and get a HDC for the printer
if(PrintDlg(&pd))
{
memset( &di, 0, sizeof(DOCINFO) );
di.cbSize = sizeof(DOCINFO);
di.lpszDocName = "DocName";
di.lpszOutput = (LPTSTR) NULL;
// Begin a print job by calling the StartDoc function.
iError = StartDoc(pd.hDC, &di);
if (iError == SP_ERROR)
{
ASSERT(0);
}
// Inform the driver that the application is about to begin sending data.
iError = StartPage(pd.hDC);
if (iError <= 0)
{
ASSERT(0);
}
//Get the Screen-resolution(1)
ScreenHdc = ::GetDC(NULL);
fPixXWnd = ::GetDeviceCaps(ScreenHdc, LOGPIXELSX);
fPixYWnd = ::GetDeviceCaps(ScreenHdc, LOGPIXELSY);
::ReleaseDC(NULL, ScreenHdc);
//...or get the Screen-resolution(2), not tested
fPixXWnd = ::GetSystemMetrics(SM_CXFULLSCREEN);
fPixYWnd = ::GetSystemMetrics(SM_CYFULLSCREEN);
//Get the Printer-resolution
fPixXPrint = (float)::GetDeviceCaps(pd.hDC, LOGPIXELSX);
fPixYPrint = (float)::GetDeviceCaps(pd.hDC, LOGPIXELSY);
//the alignment for your window-coordinate
fScaleX = fPixXPrint / fPixXWnd;
fScaleY = fPixYPrint / fPixYWnd;
....
e.g. you draw your Bitmap to your view with
StretchBlt(hdcWnd, 10, 10, 100, 100, hdcBmp, 0, 0, 50, 50, SRCCOPY);
now write the following for your Printer
StretchBlt(hdcPrint, 10*fScaleX, 10*fScaleY, 100*fScaleX, 100*fScaleY, hdcBmp, 0, 0, 50, 50, SRCCOPY);
HTH
Regards
Frank
|
|
|
|
|
Hi !
I posted a question yesterday about printing a postscript file in C++. I still need more informations about this. How can I, in C++ : open the printer device, write the file to the open handle, and close the printer device ?
Thank you for your help !
Jerome
|
|
|
|
|
Off the top of my head:
OpenPrinter
StartDoc
WritePrinter
EndDoc
ClosePrinter
if you need further advise, let me know. I've done it in one of my projects.
Joel Lucsy
|
|
|
|
|
Thank you for your answer. But I guess you are mentionning MFC functions, right ? I was trying to do it in standard C++ (I didnt mention it clearly in my question).
Thank you for your help anyway,
Jerome
|
|
|
|
|
Those are standard Win32 functions, no MFC needed. Did you try looking them up in MSDN?
Joel Lucsy
|
|
|
|
|
Actually, my application has to be crossplatform, so I'm not allowed to use any Win32 functions. This is why I wanted to do it using standard C++ !
Jerome
|
|
|
|
|
Ah, crossplatform, that is an entirely different matter. Since everything is a file under *nix you may be able to use straight file operations as long as you know how the printer is connected. Note, however, that Win32 and *nix completely differ on how printers are handled, you will have to right different code for each.
For *nix, look for the CUPS package. This is the only thing I know of that may make things easier for that platform.
Joel Lucsy
|
|
|
|
|
Hi All gurus,
I have a small problem regarding windows startup time..I have to add an application at windows startup..I have found many things on that and I have finished this part..but the real problem occurs when I restart or logoff..I want my application to be the first one to load..after necessary windows..programs..so that user is not able to access anything..before startup..and must see my application first..can anyone help me out..I know something can be done..Any help or pointers are highly appreciated..
Thanks a lot in advance,
Himanshu
|
|
|
|
|
Hi Himanshu
I know 2 ways:
- move your program (link) to the autostart folder
- write your program as service and start the service always -> systemsettings (I think the better way)
Regards
Frank
|
|
|
|
|
There is no way, short of replacing system files, to guarantee that your application will be the first to start. Items in the startup folder are loaded after all services have been loaded. Even if it were a service, you could only guarantee that it start AFTER another application, but never before.
|
|
|
|
|
how to create text editor into single dialog/mfc???? (like notepad)
or can I link notepad into my program??
====================^_^
|
|
|
|
|
ariez wrote:
how to create text editor into single dialog/mfc???? (like notepad)
You can run the MFC application wizard to build an SDI application, but on the very last step, select CEditView as the base class. Compile the program and you will have a text editor without writing a single line of code.
ariez wrote:
or can I link notepad into my program??
You can run notepad from your program by using ShellExecute(). Check MSDN on how to use that function.
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
Check out the Wordpad example on MSDN.
|
|
|
|
|
Hi,
How to use VC++ to trigger a list box's onChange event for a Select object in a html page.
I use CHtmlView, I can get the Interface of the listbox. I also use put_selectedIndex to chance the select item.
Thanks a lot!!
Alan Shen
|
|
|
|
|
Hi:
I create a splitterwnd in my application with 2 rows ,1 colume.I want to change the size of one pane in the SplitterWnd(such as the view in first row),and I can't find a function in MSDN to do so. How could I do?
Thanks
Benben
|
|
|
|
|
CSplitterWnd::SetRowInfo() , CSplitterWnd::SetColumnInfo()
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"
|
|
|
|
|
Ryan Binns wrote:
CSplitterWnd::SetRowInfo(), CSplitterWnd::SetColumnInfo()
Wow! I looked at them but I didn't really bother reading the info, so my suggestion was to use MoveWindow. Would that work?
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
Toni78 wrote:
MoveWindow. Would that work?
No. The sizes are cached in the CSplitterWnd class, so bypassing them would produce errors later on.
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"
|
|
|
|
|
Thank you! I'd better delete my reply then.
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
But it seems that these function only works for the first row.
when I try CSplitterWnd::SetRowInfo(0,10,10) , it works well.
but if I try CSplitterWnd::SetRowInfo(1,10,10),nothing happen
Thanks
Benben
|
|
|
|
|
Did you call RecalcLayout() ?
My opinions may have changed, but not the fact that I am right.
|
|
|
|
|
I'm a student. I'm learning windows programming. Now I want to write a wordpad in API and without using edit control. I find there are too much things I must deal with. I'm puzzled.
Would you have something like this. Please give me the sample or source code.
Thank you very much.
Email : goldwing1024@hotmail.com
I want to know
|
|
|
|