|
Do you want to use the DLL and load the images into your program?
If so, you can first load the DLL that you want to use the images from with LoadLibrary . Save the HMODULE that you recieve from LoadLibrary because you will need to use that handle when you call LoadBitmap or LoadImage to load the image from the DLL. These functions will give you an HBITMAP that you can use in your program.
When you load the bitmap, you will need to know the resource ID of the bitmap that you are interested in. You can determine this by loading the DLL into DevStudio and looking at its resources. Also, you will need to use the MAKEINTRESOURCE macro to properly format the ID for the bitmap load function so that it knows you are passing in an integer rather than a string name.
Good Luck.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Thank you very much kilowatt.
Mazy
"The more I search, the more my need
For you,
The more I bless, the more I bleed
For you."The Outlaw Torn-Metallica
|
|
|
|
|
It's not in windows. It's just a dos program. I'm not sure if that's console app. If you can, e-mail me at nywebhead@hotmail.com and I'll give you the details, thanks.
|
|
|
|
|
Hi All!
I'm trying to SetFont to CWnd-derived class, but it has no effect.
I'm using member variable in my class - CFont m_font.
In my OnCreate method:
LOGFONT lf; // Used to create the CFont.
memset(&lf, 0, sizeof(LOGFONT));// Clear out structure.
lf.lfHeight = 20; // Request a 20-pixel-high font
strcpy(lf.lfFaceName, "Arial"); // with face name "Arial".
m_font.CreateFontIndirect(&lf); // Create the font.
SetFont(&m_font);
CFont *pFont = GetFont();
pFont is NULL!!!
I'm sure that font object (m_font member) remains valid, so that is not the reason.
I even tried to SetFont to child windows of this window (e.g Button or Static control)
m_wndChild.CreateEx(0, _T("Button"), m_csText, WS_CHILDWINDOW | WS_VISIBLE | WS_TABSTOP | BS_PUSHBUTTON, rctChild, pParent, 0x1234);
m_wndChild.SetFont(&(pParent->m_font));
No effect...
Can anybody tell me what's wrong?
Thank you
Levon Hayrapetyan,
Student
Yerevan State University
|
|
|
|
|
Try use
::CreateFontIndirect(&lf);
|
|
|
|
|
update:
Try Use m_Font = ::CreateFontIndirect(&lf);
|
|
|
|
|
update:
Try Use ->
m_font = ::CreateFontIndirect(&lf);
|
|
|
|
|
In an activeX (MFC) project I have defined a structure like this:
struct aaa
{
BSTR name;
int length;
}properties[200];
I have declared this structure in the C...Ctrl class.
I want the container to access the properties member (ctrlname.properties[1].name
Is it possible ? If so, how do I do that ?
|
|
|
|
|
Add a method to your ActiveX for the container to call. Have the method return the value you desire.
Goo luck,
Bill
|
|
|
|
|
hi, i'm implementing and MFC SDI application. I've inserted a new Dialog and put 1 list box in there. When i tried to add the string to the list box from the View in MFC it just display erorr. Here is the code fragment that i used in my view class:
CAss3_q1Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
Dlg dialog;
dialog.DoModal();
for (int i = 0; i< 4; i++)
{
dialog.m_team1.AddString(pDoc->A.getTeam(i));
}
It just didnt' load up and give me runtime error. ANy hints or tips.
Note: I tried to load the 4 CString object to the list, and this 4 string is in a class call group that have the method as below
CString Group::getTeam(i)
{
return team[i];
}
Cheers
|
|
|
|
|
DoModal() displays the dialog and waits until the dialog ends, typically by the user clicking OK or Cancel. You should pass a pointer to CAss3_qlDoc to your dlg object, and initialize the list box from within the dialog's OnInitDialog() handler.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hello
As you you probably understands from the question's I'm asking I'm not a very experieced developer.
I'm having trouble to understand how i can get the document length on the document i want to print..
Must I first calculate the number of rows in the document in OnPreparePrinting and then
calculate the no: of pages to set as maxpage and must I then ceep track on wich page that is currently printing in the OnPrint function. Is this all wrong? If not is there an easiyer way to do this.
It would be great to get hold of a small example code to do this.
Thanks for taking your time.
Best regards
Henrik
|
|
|
|
|
You can use the following code to give the printer page size.
int cx = nPageWidth;
int cy = nPageLength;
static int screenXDpi = 0;
static int screenYDpi = 0;
if (screenXDpi == 0 || screenYDpi == 0)
{
CDC dcScreen;
dcScreen.CreateCompatibleDC(0);
screenXDpi = dcScreen.GetDeviceCaps(LOGPIXELSX);
screenYDpi = dcScreen.GetDeviceCaps(LOGPIXELSY);
}
cx = (cx * 1440) / 2540;
cy = (cy * 1440) / 2540;
cx = (cx * screenXDpi) / 1440;
cy = (cy * screenYDpi) / 1440;
nPageWidth = cx;
nPageLength = cy;
Regards
Jack
--------------------------------------
Xtreme Diagram++ MFC Library with full source code.
http://www.ucancode.net/
|
|
|
|
|
THANK YOU !!!!!, It helped me a lot
|
|
|
|
|
This is strange.
I have recently added a dynamically created Groupbox control to my CScrollView derived window. I find the area under the lines of the Groupbox become transparent as soon as the window is moved etc. Parts of other underlying screens show through. The area where the Radiobuttons are situated is corretly coloured.
Is there some simple way to make this opaque.
Any suggestions very welcome.
Sara
|
|
|
|
|
I think this has something to do with the Z-order of the group box with respect to the other controls in the scroll view. I might be wrong of course. But just see if you can do something using SetWindowPos and passing wndBottom as the pWndInsertAfter parameter.
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
How should I implement a 2-D array to be passed into a
class function? The following is what I know of
passing array.
void abc(int a[],int upperlimit)
{
for (int i =0; i < upperlimit; i++)
a[i]= 10;
}
What changes do I have to make to accomodate a[] to be a
2-D array? If I have not know the size of the 2-d array?
Should I use pointer here? I am trying to convert a fortran
code which allows for array to be declared as 2-D or 3-D array without specifying the size of the array. Is that possible in VC++ 6.0?
|
|
|
|
|
a 2-d array is basically a **.
So if you have int ar[10][20] you can prototype the function as :-
Fn(int **z); and then you can pass ar as the argument
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Nees is right.
Now, for your last q.
If you put NULL at the and of the array you woudn't need to remember
the size of the array.
Aizik Yair
Software Engineer
|
|
|
|
|
Two problems with NULL terminated arrays :
- if the array is 2D or 3D, you cannot determine row / column / 'layers' dimensions.
- what if one element of the array has a value of 0 (looks like NULL for the compiler) ?
|
|
|
|
|
<small><b>squizz wrote:
</b></small><i>if the array is 2D or 3D, you cannot determine row / column / 'layers' dimensions.</i>
I will answer this before Christian Graus.
[pre]
Use std::vector <std::vector<int> >
[/pre]and pass a reference to it to the member function.
Otherwise, provided that you know the dimension of the 2D array use
int f (int** x)
Best regards,
Alexandru Savescu
|
|
|
|
|
How do I add MFC support for an ATL project (Service) created in Visual C++ .Net?
RamDili
|
|
|
|
|
ramdili wrote:
How do I add MFC support for an ATL project (Service) created in Visual C++ .Net?
RamDili
Add the required headers and set the linker option to link MFC statically/dynamically.
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Well, I followed Article ID: Q173974 in MSDN which is kind of your suggestion. This seems to work for VC++ 6.0. But I need it for Visual C++ .Net and this is the error what I'm getting.
C2504: 'CAtlServiceModuleT' : base class undefined
If I add the headers after <atlbase.h> in stdafx.h , then I'm able to get rid of this error. But then I get this error::
c:\Program Files\Microsoft Visual Studio .NET\Vc7\atlmfc\include\afxv_w32.h(18): fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h>
Do you have any suggestions for me? thanks....
RamDili
|
|
|
|
|
It depends on what classes you want to use. If you are limed to CString then ofcourse CString is now shared with ATL/MFC you will not have any problems. If you want to use any MFC functionality that depends on the "AFX state", you need to do something more complicated especially for services.
So what exactly do you want to use?
|
|
|
|