|
I'm creating an ActiveX control, using MFC in C++, that will be inserted into IE, Word, and a custom app. I need to add a toolbar for the control that docks to the parent frame, when the control is inserted in the container.
I haven't been able to find any info about doing this.
Any help would be appreciated.
Thanks,
Chris
|
|
|
|
|
Does there exist any free code that implements something similar to the Watch window in Microsoft Developer Studio? I would like to be able to read in a header file containing definitions of structs and then display the contents of struct objects in my program at run-time.
|
|
|
|
|
I have a custom control that i do all the drawing on. If i want to print the control can i just replace the DC with a DC i get from CPrintDialog?
This works but it prints reeeally small. How can i get it to print so it is the same size as on the screen?
Scott
|
|
|
|
|
your screen is probably at 96 DPI, but the printer is likely 300 or 600 DPI. so, it's drawing with the same number of dots, but the dots are much smaller. what you need to do is to set the printer DPI (in effect) to the same as your screen DPI.
you can do this by adjust the DC's extents (see SetViewportExtent and SetWindowExtent and maybe SetMappingMode).
this might work for you:
pDC->SetMapMode(MM_ISOTROPIC);
pDC->SetWindowExt(desiredDPI);
pDC->SetViewportExt(pDC->GetDeviceCaps(LOGPIXELSX), pDC->GetDeviceCaps(LOGPIXELSY));
-c
When history comes, it always takes you by surprise.
|
|
|
|
|
What should the desiredDPI be? I tried 96 and it seems to work pretty good but it prints everything a little smaller than it should be.
I can play around with desiredDPI and get it to print almost exactly like it is on the screen but there's got to be a way to figure what this value should be?
Scott
|
|
|
|
|
try 72
When history comes, it always takes you by surprise.
|
|
|
|
|
For the modeless CDlg it goes in in Create(IDD_DLG, this). For the modal dlg, how do we send in the parent pointer? Would it have to be assigned to a member pointer of the dlg class of the parent type?
Like:
MyCDialog myDlg;
myDlg.m_dlgParentPointer = this;
myDlg.DoModal();
If GEtParent() is the way to go instead, why is that better?
Appreciate your help,
ns
|
|
|
|
|
|
But all the CDialog constructors have either 2 or zero number of arguments.....?
CDialog::CDialog in mSDN ..???
I'll try your idea but just wondering about the 1 argument constructor you have...
Appreciate your help,
ns
|
|
|
|
|
Nish is talking about the CDialog-derived class that the ClassWizard creates for you when you associate a dialog resource to a class. That one only has one parameter and it's the parent window.
Regards,
Alvaro
Quitters never win. Winners never quit. But those who never win and never quit are idiots. -- despair.com
|
|
|
|
|
Thanks. If I may....where did you find this info? Next time I'll search that resource for help as well....
I just looked in the mSDN under CDialog
Appreciate your help,
ns
|
|
|
|
|
Have you ever used the Class Wizard to generate the CDialog-derived class for your dialog box template??? I suspect you haven't. If you had, you'd have seen the constructor for the class that gets generated.
I recommend you take an online tutorial to given you a broader view on all the techniques you can use to generate MFC code. The one that really helped me (a long time ago) was the "Scribble" tutorial. It taught me all about using the Class Wizard for dialog boxes. Believe me, it's a must-know!
Regards,
Alvaro
Quitters never win. Winners never quit. But those who never win and never quit are idiots. -- despair.com
|
|
|
|
|
oh! I see the constructor. I actually do use the CW to create my CDlg derived classes, but when i make a new object I didnt think ( ) of looking at the .h file. Instead I went looking for the CDialog docs...
But thanks I shall look at scribble.
Appreciate your help,
ns
|
|
|
|
|
I have a program that when compiled must remain the same. I am using preprocessor directive to make some significant changes to the program. Where I have been stumped is in the icon changes. I have managed to get all the icons within the application changed and the one's on the toolbar and all.
I am having to force the changes to the taskbar icon and Alt-Tab at compile time manually because I cannot figure out how to change them. I have not figured out how to change the icon on the right click properties menu on the application from explorer.
Basically I have 2 programs in one project. Each with seperate icons and program names. I have not been able to figure out how to change the icons in the second program at compile time.
Can anyone help?
|
|
|
|
|
|
Is there any programmer that wrote any program for Advantech DAC (PCL810HD series)?
Please help me!!!
A. Riazi
|
|
|
|
|
good day!
still trying to custom paint CEdit borders, it's working more or less ok now, but I'm having problems with coordinates (rect) of my control, and where I paint.
This is what I do now, it does work when the CCustomEdit is in a dialog without any border, my main "target", but now I have to use this in other dialogs, and the clientRect is wrong, the conversion is not good, and does not take into account the dialog borders (caption, borders, ... ).
What is the proper sequences to get the CEdit rect ( in the dialogs coordinate ) and Inflate it to fit the CCustomEdit rect ?
The target look is to have the border around the CEdit.
void CCustomEdit::OnNcPaint() <br />
{<br />
CDC* pDC = GetParent()->GetWindowDC();<br />
<br />
CRect windowRect;<br />
GetWindowRect( windowRect );<br />
<br />
CRect clientRect;<br />
GetClientRect( clientRect );<br />
<br />
ClientToScreen( clientRect );<br />
GetParent()->ScreenToClient( clientRect );<br />
<br />
clientRect.InflateRect( 2, 2, 2, 2 );<br />
pDC->FrameRect( clientRect, &m_BorderBrushFocus );<br />
<br />
ReleaseDC(pDC);<br />
<br />
}
Thanks.
Maximilien Lincourt
For success one must aquire one's self
|
|
|
|
|
I emailed you a little demo app that shows how to do this using OnNCPaint() , OnNCCalcSize() , and PreSubclassWindow() .
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!
|
|
|
|
|
hey guys, I am trying to get an idea of how I can write functions in C++ which can be used by visual basic 6 programmers.. anyone have any suggestions on where to get started? i have seen how dlls work looking at the introduction to com article, but that dll doesnt seem to work in vb, keeps giving me 'can't fint dll entry point' errors..
im also considering switching to c#, is it easier to write dlls in c# that to learn how to in c++?
if i could just have one example that would work in vb that would help so much.. anyone got any links?
thanks a bunch!
still a newb.. cut me some slack :P
-dz
|
|
|
|
|
See if this helps
in some .h file
long __stdcall GetAccountCodeFromAccountNumber(char*, long);
in your .cpp file
long __stdcall GetAccountCodeFromAccountNumber(char* caAccountNumber, long nCharacterCount)
{
long nReturnValue = 0;
.. do what ever you want kinda stuff.
return nReturnValue;
}
what's needed in the VB program
Public Declare Function GetAccountCodeFromAccountNumber Lib "TradeInput.DLL" ( ByRef AccountNumber as String, ByVal AccountNumberLength as Long ) as Long
Dim AccountNumber as String = "123456";
Dim AccountNumberLength as Long = 6;
Dim AccountCode as Long = GetAccountCodeFromAccountNumber(AccountNumber,AccountNumberLength);
Chris Meech
"what makes CP different is the people and sense of community, things people will only discover if they join up and join in." Christian Graus Nov 14, 2002.
"AAAAAAAAAHHHHHH!!!!! Those leaks are driving me crazy! How does one finds a memory leak in a garbage collected environment ??! Daniel Turini Nov. 2, 2002.
|
|
|
|
|
i tried what you have here, but unfortunately im still getting my Run-time error 453 - Can't find DLL entry point GetAccountCodeFromAccountNumber ...
i tried what goes in the .cpp file both with and without the class name preceding the GetAccountCoddeFromAccountNumber(char*... but it didnt make a difference.. im going to try to create a new project (instead of using the one in the introduction to com example) .. what type of project should i select? MFC DLL im assuming.. ill let you know if that does anything for me..
thanks for the example!
still a newb.. cut me some slack :P
-dz
|
|
|
|
|
Sorry, I did that too quickly. You also need to export the function.
in the .def file
EXPORTS
...
GetAccountCodeFromAccountNumber @99
...
Chris Meech
"what makes CP different is the people and sense of community, things people will only discover if they join up and join in." Christian Graus Nov 14, 2002.
"AAAAAAAAAHHHHHH!!!!! Those leaks are driving me crazy! How does one finds a memory leak in a garbage collected environment ??! Daniel Turini Nov. 2, 2002.
|
|
|
|
|
You are the man Chris Meech! Thanks fer helpin me out!
still a newb.. cut me some slack :P
-dz
|
|
|
|
|
Hello all!!
I will open a simple text file in MDI or SDI Project.
can somebody help me how i do this.
THX.
|
|
|
|
|
All you need to do is create a SDI or MDI of type CEditView... Then click the open button or from the menu and point it to a text file..
|
|
|
|