Calling GetDC from COM vs WinApp

when I call GetDC from MFC Dialog Based application i called like this

CDC* pDC = GetDC();

but when created an ATL COM project and added function , i can not call it 
same way the signature there

HDC GetDC(HWND hWnd);

how can i get the CDC * ,as in window app?
0
10/24/2005 12:06:02 PM
vc.mfc 33608 articles. 0 followers. Follow

1 Replies
650 Views

Similar Articles

[PageSpeed] 10

Raed Sawalha wrote:

> when I call GetDC from MFC Dialog Based application i called like this
> 
> CDC* pDC = GetDC();
> 
> but when created an ATL COM project and added function , i can not call it 
> same way the signature there
> 
> HDC GetDC(HWND hWnd);
> 
> how can i get the CDC * ,as in window app?

Raed:

If you don want to use MFC in your component, you can't. But the class 
CDC is essentially just an OO wrapper for HDC. E.g.

BOOL CDC::Rectangle( int x1, int y1, int x2, int y2 );

BOOL ::Rectangle(HDC hdc, int x1, int y1, int x2, int y2 );

Just use the HDC that you get from ::GetDC().

HTH,

David Wilkinson



0
no-reply8010 (1791)
10/24/2005 1:01:42 PM
Reply:

Similar Artilces:

NZ Function and Null VS 0 values
Here is my question, I have the following statment in a query: PostSumCreated: Sum(NZ([Post_Sec2_7CreatedTotal]) +NZ([Post_Sec3_5CreatedTotal])+NZ([Post_Sec4_3CreatedTotal]) +NZ([Post_Sec4_5CreatedTotal])+NZ([Post_Sec5_4CreatedTotal]) +NZ([Post_Sec6_7CreatedTotal])+NZ([Post_Sec7_4CreatedTotal])) This returns either the number of the addition or 0. The problem is that I have NULL values in the table, where 0 would represent that yes nothing was done and Null would represent that nothing was support to happen. What I need help with is trying to add the needed columns if they have a value >...

OleDb SqlDataSource stored procedure call parameter order mixed up ?
I am using a OleDb SqlDataSource to bind to a GridView The SqlDataSource is defined as follows: <asp:SqlDataSource ID="SqlDataSource1" runat="server" ProviderName="System.Data.OleDb" ... UpdateCommand="mp_Update" UpdateCommandType = "StoredProcedure" ... > <UpdateParameters> <asp:Parameter Name="@ret_val" Type="Int32" Direction=ReturnValue /> <asp:Parameter Name="usr_id" Type="String" Size="32&qu...

read vs write file
If I open a file with macros... it could had been opened as read only or as read/write.... Then how do I check with a macro if it was opened as read only or as read/write? bReadOnly = wb.ReadOnly where wb refers to the workbook you want to know about Regards, Peter T "Alberto Ast" <AlbertoAst@discussions.microsoft.com> wrote in message news:309F56ED-42AC-4C94-93E9-692A752327E7@microsoft.com... > If I open a file with macros... it could had been opened as read only or > as > read/write.... > > Then how do I check with a macro if it was ...

COM for Linux
Does anybody know Linux libraries of implementation of COM. Every body says - COM is platform independent - you can use COM to create applications on any platform, But for a long time already i can not find a single programmer or company who support set of COM classes/or interfaces under platform different that windows. Why? Dmitry Some time ago I have used Software AG's Entire X successfully. You should try it. I don't know any other solution. -- Un saludo Rodrigo Corral Gonz�lez [MVP] FAQ de microsoft.public.es.vc++ http://rcorral.mvps.org Rodrigo, > Some time ago I h...

error C2664 and error C2440 when migrating to VS 2005
Hello everyone, I have upgraded to VS 2005 and when I compile a program that I wrote in the previous version VC++ 6.0, I get few errors: 1) error C2664: '_com_ptr_t<_IIID>::_com_ptr_t(int)' : cannot convert parameter 1 from 'FnComPtr<IUnknown,& IID_IUnknown>' to 'int' (FnComPtr being the smart pointer.) 2) error C2440: 'initializing' : cannot convert from 'FnComPtr<T,iid>' to '_com_ptr_t<_IIID>' Anybody getting the same error or knowing about this issue please respond Thanks in Advance.. sab ...

Xml validation exception only occurs outside debugger
Hi, I am experiencing a strange problem. I am reading and writing xml files via XmlDocument and XmlTextWriter. In the debugger everything works fine but outside the debugger (debug or release) I receive the following error: "The type initializer for "System.Xml.Schema.Validator" threw an exception." I wrote a small console app that contains the problem -- I've just attached the default class which gets run. Output outside the debugger is as follows ------------------ Creating xml file Reading xml file Error reading xml file The type initializer for "Syst...

Proper call for Session.variable(x)
In the VBScript element of QSBridge. Looking at the displayvariables example. How does one properly call one of the 10 pre-set Session Variables and put them into an object, let's say txtPriceCalc.innertext = Session.Variable5 ? I cannot seem to get it properly called. Any prior experice or pseudocode is more than welcomed. This is the final sticking point that I have! Any advice is appreciated. Kevin Var10 = QSRules.Session.Variable(10) I kept calling it without the parentheses. For everyone's record this styling works in vbscript in the status.htm! Now I need a conditional to ...

Internal links in Word vs. in a pdf
I'm working on a document that has a lot of internal links (mostly from a table of contents to the heading in question). When I look at the file in Word 2007, the links work perfectly and go to the exact correct spot. When I convert the file to a pdf, however, the links don't work quite right anymore--they still exist and send you to a new page, but rather than sending you to the exact heading, they take you to the top of the page that the heading is on. If the heading is at the bottom of the page, you can't see it without scrolling down a little, and I'm afraid o...

Sort Order vs Comparison Order
I have a list on an Excel spreadsheet which I have sorted. Among other entries, the list has "Con" and "CWC". When I sort, it places "Con" before "CWC". In VB, I am comparing the fields in the sorted list. In the VB comparison statement, it sees "CWC" as being less than "Con" (presumably because the Hex value for the "o" is greater than the Hex value for the "W"). Is this correct? And is there any way to make the two look at the data in the same way? I can't reproduce your problem. Can you post th...

Using XPath to read VS 2005 csproj files
I am loading a VS2005 csproj file into an XPathDocument then am creating an XPathNavigator. I am trying to use XPath to pull the Include attributes from the EmbeddedResource Element of the ItemGroup Element. For some reason I cannot get the XPath syntax right to pull these attributes from the file. For example, I am trying to pull out the values(AlphanumericTextBox.bmp, CurrencyTextBox.bmp, DateTextBox.bmp, DateTimeTextBox.bmp, IntegerTextBox.bmp, MaskedTextBox.bmp, MultiMaskedTextBox.bmp, NumericTextBox.bmp, TextBox.resx). Anyone have any idea what the XPath statement should be to get the...

"Internet Mail Only" vs "Corporate-Workgroups".
Hi , I want to check programmatically in outlook 2000 that I am in "Internet Mail Only" or in "Corporate-Workgroups". Can any one have idea that in registry where I can get these setting information. Thanks in advance Dear, Go to control panel, mail icon, - there you can see whether Internet mail or Corp/workgroup. -- (Please respond to this question Was this post helpful to you?) Hope this helps you more Regards APK "Ashutosh Choubey" wrote: > Hi , > > I want to check programmatically in outlook 2000 that I am in "Internet > M...

How to call an .exe Add-On with a custom menu....
Hi; I have a custom solution developped in visio 2002. There the way of seting properties of menu is as follows. menuItemObj.Caption = "Check &Completeness" menuItemObj.AddOnName = "SetXMLGenerateMenu" menuItemObj.AddOnArgs = "Validate" menuItemObj.Enabled = True menuItemObj.Visible = True The AddOn used here is an exe file (SetXMLGenerateMenu.exe). But this doesn't function in Visio 2003. It gives the run time error saying "Script out of range", when I click on the menu to call the exe. Visio 2003 SDK defines the way o...

Stange behavior between MFC and COM in VC6
I have discovered an unusual bug which is easily reproducible. I am wondering if anyone has ever noticed this: Create an MFC application with a single document interface. In stdafx.h add near the top: #define _WIN32_WINNT 0x0400 In the CDocument constructor add: CoInitializeEx(NULL, COINIT_MULTITHREADED); Build the app. Now click File Open and navigate to the desktop shortcut at the top of the tree view. From here you should see your My Documents folder listed (unless you have removed it from your desktop, in which case you can't test this senario). If you now double click the My D...

delegate vs condition check
hello everyone, today i tested the speed of a delegate relaying to a function against the speed of an an if, that checks the condition of a boolean value, relaying to a function (the code is attached at the end of this post). in my test it turned out, the delegate was twice as fast as checking the boolean. this lead me to the conclusion, that whenever object behavior depends on values, known from time of construction, it is faster to compose an object (compose of delegates and/or other objects) at construction time, rather than checking condition(s) every time an object is used. ...

Excel's financial currency format vs. Access currency format
Who can shine a light on this? In forms and reports I woul like to show currency according the Excel Financial format that is: the currency symbol should be left aligned and the digits right aligned. E.g. €12.345,60 should be displayed as € 12.345,60 depending on the width of the field. Thanks for your suggestions/tips,Ron ...

Outlook vs. Outlook Express
Although I have installed and use Outlook to send and receive mail, whenever I try to send mail using a web- pages "send e-mail" button, Outlook Express launches instead. I have set Outlook as my default mail program, but this still doesn't prevent Outlook Express from launching instead. Any solutions to this problem? ...

Calling Addin function?
Hello, I created an addin for excel, work find when in the spreadsheet... but now I want to be able to call my functions from within VBA? The addin is loaded? How can I do this? Thanks, Brian -- Please remove the 123 from the EMAIL Address. This has been added to prevent spamming. pssssst! Here spammer, spammer, spammer. pyramid@ftc.gov, bbroder@ftc.gov, jcheezum@uspis.gov, fraud@uspis.gov Hi Brian! If you set a reference to it you can call it just like the function is in the subject workbook. Tools > References Check against your Addin. -- Regards Norman Harker MVP (Exce...

www.jraun.com
i have had a website called www.jraun.com "infect" inself into MS Outlook 2002. when i open Outlook (it opens with the personal folders so that the screen shows the calendar, tasks, etc)and i then click on a folder containing Emails, or the calendar, or contacts, etc, the right hand side of the screen, instead of displaying the expected information, turns itself into MS Internet Explorer and displays a web site. if i click on any other folder, i see the Emails listed for half a second - and then it reverts to being a web page again. The "bar" near the top of the s...

pcnetsecurity@gmail.com =?UTF-8?B?QXNzaXN0w6puY2lhIFTDqWM=?= =?UTF-8?B?bmljYSAgbWFudXRlbsOnw6M=?= =?UTF-8?B?byBkZSBjb21wdXRhZG9y?= =?UTF-8?B?ZXMgaW5mb3JtYXRpY2Eg?= =?UTF-8?B?Vml0w7NyaWEtZXMgMTcyOTI=?=
Contato: pcnetsecurity@gmail.com Contato: pcnetsecurity @ gmail.com Planos a partir de R$ 250,00 . Assist�ncia T�cnica Prestamos assist�ncia t�cnica nos computadores de sua empresa ou resid�ncia, e tamb�m possu�mos uma equipe qualificada para fazer a manuten��o no pr�prio local. - Contratos de Suporte e Manuten��o Reduza os custos de sua empresa com solicita��es de visitas t�cnicas para seus computadores, elaboramos um contrato de manuten��o integrado para sua empresa onde disponibilizamos: t�cnicos, equipamentos de suporte e substitui��o, e atendimento no hor�rio comercial ou ...

pcnetsecurity@gmail.com =?UTF-8?B?QXNzaXN0w6puY2lhIFTDqWM=?= =?UTF-8?B?bmljYSAgbWFudXRlbsOnw6M=?= =?UTF-8?B?byBkZSBjb21wdXRhZG9y?= =?UTF-8?B?ZXMgaW5mb3JtYXRpY2Eg?= =?UTF-8?B?Vml0w7NyaWEtZXMgNDY0ODQ=?=
Contato: pcnetsecurity@gmail.com Contato: pcnetsecurity @ gmail.com Planos a partir de R$ 250,00 . Assist�ncia T�cnica Prestamos assist�ncia t�cnica nos computadores de sua empresa ou resid�ncia, e tamb�m possu�mos uma equipe qualificada para fazer a manuten��o no pr�prio local. - Contratos de Suporte e Manuten��o Reduza os custos de sua empresa com solicita��es de visitas t�cnicas para seus computadores, elaboramos um contrato de manuten��o integrado para sua empresa onde disponibilizamos: t�cnicos, equipamentos de suporte e substitui��o, e atendimento no hor�rio comercial ou ...

MS Query: WHERE vs HAVING
When I use MS Query to bring data from an external source, Query usually translates my criteria into a HAVING statement, which results in my criteria being included in the GROUP BY statement -- which I do not want. I then have to manually change the HAVING to a WHERE, move the criteria up above the GROUP BY and edit the GROUP BY. I don't like to be bothered to do this, and have trouble explaining this technique to others. Is there a way to make MS Query default to WHERE instead of HAVING? Is there a way to influence which method is used for a particulary query? Thank you. ...

QuickBooks Enterprise vs. Microsoft GP
I have to help a customer to decide between implementing QuickBooks enterprise or Microsoft GP. I know that GP has a lot more features than QuickBooks enterprise but sometimes companies don't need all the features on GP.The customer will have 10 users. Could anybody point me to the most important features that QuickBooks lacks? Please remember that the comparison is with the Enterprise edition of QuickBooks and not any other like pro or premier. If they are seriously considering QB Enterprise against GP, tell them to buy QB. Usually when a customer is still seriously considering QB, th...

Searching cells for hard coded data vs formulas
Can anyone tell me how to define a Find query in cell which will fin all the cells in a sheet which have constants in them (i.e. =2, 2, A2+ etc). That is, I want to build an audit function which checks cells t make sure there are not any hard coded constants in any cells. Th goal will be to automate it at a later date. For now I just want t know what the syntax is for the query in the Find option. Thank-yo -- ExcelMonke ----------------------------------------------------------------------- ExcelMonkey's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=522 View...

Outlook 2002 RPC call
I have a remote user who has a WINXP machine with Outlook 2002. Had an issue with the motherboard, local vendor had him format drive. Clean install of OS and Office, no problems. Set up his VPN connection and his Exchange Server mail settings in outlook. He has connected via both dial up and DSL. Gets on VPN connection fine, but when opens outlook to sync up or does manual send/receive, PC pus up error message of "RPC call, your system will reboot in 30 seconds. Please close all programs". Countdown then starts and system shuts down. NO CANCEL BUTTON to stop the error mess...

"Transfer Out" Call Option
I manually entered into Money 2007 Deluxe a covered call (buy stock, sell to open for a call option) that I made in September 2007. In November 2007 I transferred all of the assets (including the stock and short call) to another account. I was able to "transfer out" all of the equities to the new account. When I try to transfer the call MS Money says that "The activity 'transfer out' is unavailable for the investment type you have selected." In reality the calls were transferred from brokerage to brokerage. Any ideas how to make this happen in MS Money 2007? Thank...