Click here to Skip to main content
       

C / C++ / MFC

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page  Show 
GeneralRe: Need Debugging tips: MFC static library DLLmemberClark Kent12318 Jan '13 - 4:32 
Yes, you are correct. In my VB program I am using the P/Invoke technique to call this library of C++ functions. But it's not fun that I can't debug it. Frown | :(
 
Oh well. The original author did it this way and it's going to take so much work to make it a COM object. Not sure if I want to go down that path. But thanks for the info.
AnswerRe: Need Debugging tips: MFC static library DLLmemberAlan Balkany18 Jan '13 - 5:21 
"Whenever I place a breakpoint in the cpp file and run the main program (VB) the breakpoint I placed in the cpp will not be hit according to the compiler."
 
When debugging managed code that calls unmanaged code, there's a setting (in Properties | Debug) called "Enable unmanaged code debugging". If this isn't checked, the debugger won't step into the unmanaged code.
QuestionHow to detect USB Device and sends datamemberyogeshs16 Jan '13 - 21:24 
Hello Friends
 
I am creating an application in which m sending data to printer for printing using COM and LPT port.Now, I want to do same using USB port.
 
For COM and LPT port,am setting port first by using fn CreateFile which Gives me handle of COM and LPT port.To createFile fn,first parameter is name of port that is COM1,COM2.. And then sending data to that port and Its working fine.
 
Now,For USB, I tried GetRawInputDeviceList but its not returning me any HID device.
Or there any other way to detect USB device?
 
Thanks In Advance.
Yogesh
AnswerRe: How to detect USB Device and sends datamember«_Superman_»16 Jan '13 - 21:54 
You can use the Printer APIs -
EnumPrinter
OpenPrinter
WritePrinter
ClosePrinter
Here is the list of all APIs - Print Spooler API Functions[^]
«_Superman 
I love work. It gives me something to do between weekends.


Microsoft MVP (Visual C++) (October 2009 - September 2013)

Polymorphism in C

GeneralRe: How to detect USB Device and sends datamemberyogeshs16 Jan '13 - 23:05 
Thanks For Reply. But I am not facing any prob in printing.I already created a application which takes care of job added and Queue.
Main problem is now with USB device,how can I get the Handle of that. How can I enumerate the USB device name list ?
 
Or if ther is any function in printer spooling which enumerate USB devices,let me know,I didnt get from this printer spooling fn.
 
Yogesh
GeneralRe: How to detect USB Device and sends datamemberJochen Arndt17 Jan '13 - 0:49 
USB devices can be enumerated with the Setup API functions (SetupDIGetClassDevs() to specify a class like USB devices, SetupDiEnumDeviceInfo() to enumerate the devices, and SetupDiGetDeviceRegistryProperty() to retrieve properties).
 
But this may not help you. Even if you identify an USB printer and opens a connection to it, you must know how to communicate with the printer. This information is printer manufacturer and model dependant and usually not publicly available.
AnswerRe: How to detect USB Device and sends datamemberDean M. Sands, III17 Jan '13 - 3:09 
The first step in your quest is to get the Windows Driver kit[^].
Second, check out this blog post[^].
This page from the MSDN[^] might also be helpful.
 
Happy coding!
AnswerRe: How to detect USB Device and sends datamemberErudite_Eric18 Jan '13 - 0:22 
You need to register for device change notification events specifying the USB UID. And on start up you need to enumerate the device already there.
 
It is a two stage registration process, by type then by handle, that way you get the device removal notification event and you can release any handles you have open on the device (else you screw the system up).
 
Dont have any links but the SDK should provide all the funcs you need if you search for 'device change notification'.
 
--edit--
 
Actualy google threw this up straight away: http://msdn.microsoft.com/en-us/library/windows/desktop/aa363432(v=vs.85).aspx
==============================
 
Nothing to say.

QuestionMFC architecturemembershanmugarajaa16 Jan '13 - 18:37 
Dear Friends,
I am working for MFC application. But I dont know about MFC architecture, classes, why CWinApp, CDocument, Cview and where execution starts and execution flow etc... Iam keen to learn all those things. So kindly anyone help me.
 
Thanks and Regards,
 
S.Shanmuga Raja
AnswerRe: MFC architecturemembersujayg16 Jan '13 - 18:49 
Hi There ,
 
MFC architecture is too big to be discussed on a forum .
 
I would suggest you go through the book of Jeff Prosise, to understand it better .
Sujay Ghosh
 
Blog : http://sujay-ghosh.blogspot.com

AnswerRe: MFC architecturemember«_Superman_»16 Jan '13 - 21:56 
What you're actually asking for is the Document-View architecture supported by MFC.
You can start here - Document/View Architecture[^]
«_Superman 
I love work. It gives me something to do between weekends.


Microsoft MVP (Visual C++) (October 2009 - September 2013)

Polymorphism in C

AnswerRe: MFC architecturememberAlan Balkany17 Jan '13 - 5:14 
This is a good introduction to MFC: http://msdn.microsoft.com/en-us/library/aa716527%28v=vs.60%29.aspx[^]
AnswerRe: MFC architecturememberMaximilien17 Jan '13 - 9:29 
For an insider understanding of MFC, you can have a look at the MFC Internals[^] books.
Nihil obstat

GeneralRe: MFC architecturemembersujayg17 Jan '13 - 18:54 
MFC Internals would be too much for him. Right now , he is trying to understand the MFC architecture . Wink | ;)
Blog : http://sujay-ghosh.blogspot.com

GeneralRe: MFC architecturememberMaximilien18 Jan '13 - 1:26 
If I remember correctly, that book, while being more "advanced", was a good reading and help understanding the mess that was MFC; it is a little better now.
Nihil obstat

QuestionHow does GDI+ decide which to use, alphablending or dithering?memberCode-o-mat16 Jan '13 - 10:49 
Hey guys!
 
Does any of you have an idea how GDI+ -when filling a rectangle or a region with a color that has an alpha component set- decides to use dithering instead of "real" blending? We are using a third-party library to generate PDF files. When using a printer DC as a "reference" to generate the PDF document, GDI+ seems to use "normal" color blending when filling an area with a translucent color, but when using a screen DC to do the same it "magically" decides to use dithering which produces a "less satisfying" result.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<

AnswerRe: How does GDI+ decide which to use, alphablending or dithering?memberJackDingler16 Jan '13 - 11:13 
In many cases, the device driver determines how the GDI+ functions operate.
The printer driver for your printer may not support alpha blending.
 
You might try using a memory DC to build up your graphics, then blitting that to your printer DC.
GeneralRe: How does GDI+ decide which to use, alphablending or dithering?memberCode-o-mat16 Jan '13 - 23:21 
It's the other way around actually (read my original post again), when using the printer, i get alpha, when using a screen based DC, i get dithering, this is why i don't understand it, since i KNOW that i can use e.g. AlphaBlend[^] on the screen without any problems, or if i use GetDeviceCaps[^] on the screen DC i see that it supports blending.
I kinda know that the capabilities of the device is -at least usually- determined by the driver "under" it, what i would like to know is what GDI+ does to come to the conclusion that the screen-based device is incapable of blending and thus resorts to "low quality" dithering.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<

GeneralRe: How does GDI+ decide which to use, alphablending or dithering?memberJackDingler17 Jan '13 - 5:07 
If you're getting dithering, then your bits per pixel may be set to less than 24 bits.
 
Like I said, the device drivers do most of that work. GDI+ doesn't really make any decisions.
 
I've never seen reliable results in alpha blending from GDI+. I avoid it and either write my own code to do it, or use OpenGL.
Questionhow to get window color?groupVCProgrammer16 Jan '13 - 1:36 
hi all,
 
i want to get window color that is appear on window border,start menu and taskbar.
 
how can i do this?
 
thanks in advance.
AnswerRe: how to get window color?mvpRichard MacCutchan16 Jan '13 - 2:12 
See the GetSysColor function[^].
One of these days I'm going to think of a really clever signature.

GeneralRe: how to get window color?groupVCProgrammer16 Jan '13 - 17:40 
yes i already use this .
 
i am using windows 7, and set Leaf color here "Control Panel\Appearance and Personalization\Personalization\Window Color and Appearance"
 
but using GetSysColor this color cant get even i chk this for all values.
 
please help me which value is use to get this color?
 
thanks.
AnswerRe: how to get window color?memberJochen Arndt16 Jan '13 - 22:19 
With enabled themes you can use GetThemeColor[^]. See also the CP article Add XP Visual Style Support to OWNERDRAW Controls[^]. It may contain useful information (the demo application is based on the no longer available ThemeExplorer from Microsoft which shows the colors for the various GUI elements).
GeneralRe: how to get window color?groupVCProgrammer18 Jan '13 - 18:42 
//i am use GetThemeColor like this.

// Getting the text color used for taskbar captions.
	HTHEME hTheme = ::OpenThemeData(NULL, VSCLASS_TASKBAND);
	ATLASSERT(hTheme);
 
	COLORREF clrText = 0;
	if(hTheme)
	{
		const HRESULT hr = ::GetThemeColor(hTheme, TDP_GROUPCOUNT, 0, 
										   TMT_BORDERCOLOR, &clrText);		
 

		ATLASSERT(SUCCEEDED(hr));
 
		::CloseThemeData(hTheme);
	}
 
	// Classic visual scheme.
	::FillRect(pDC->m_hDC, &banner_rect, ::GetSysColorBrush(CTLCOLOR_DLG));
 
	// Themed visual scheme. Draw transparently.
	::DrawThemeParentBackground(obj_RecProfDlg->GetSafeHwnd(), pDC->m_hDC, &banner_rect);
 
 
but its not useful
 
so please help me ,what values i can use GetThemeColor
 
thanks.
QuestionHow to draw a banner and button ?groupVCProgrammer15 Jan '13 - 20:24 
hi all,
 
i want t draw banner and button for the dialog box according to current system theme.
 
please help me how can i do this.
 
thanks in advance.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   


Advertise | Privacy | Mobile
Web01 | 2.6.130523.1 | Last Updated 25 May 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid