|
Hi,
Thanks it seems working. But one more problem. My code is now like this.
CButton mybutton;
HICON myicon;
myicon=AfxGetApp()->LoadIcon(IDI_ICON1);
RECT myrect;
myrect.top=10;
myrect.bottom=30;
myrect.left=10;
myrect.right=30;
mybutton.Create(" ",WS_CHILD|WS_VISIBLE,myrect,this,1);
mybutton.EnableToolTips(TRUE);
mybutton.SetIcon(myicon);
// AfxMessageBox("Complete");
Now my problem is if I comment that AfxMessageBox I am not finding the button. One more problem is, I am not finding the Icon on button. What's wrong with my code??
Thanks
Satya
|
|
|
|
|
I have a suggestion for you. You have to learn the basics of programming..."take it on the lighter side."
You are declaring the mybutton variable within the local scope, So when the program exits the current scope, that variable will no longer exist. Make mybutton a member of the class, and try.
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
I have a set of legacy DLLs which are being maintained, but proving very difficult to manage. First issue: they are written in C and not compiled under VisualStudio, and we have opted to leave them as-is.
Does anyone know the simplest way of embedding version information into them without going down the <project>.rc route? Or how can I call the resource compiler before the C compiler from my makefile?
Obviously I can link them with the Windows Version.lib to give the correct external interfaces - but how do I actually embed the data into the DLL?
Many thanks, Jay
|
|
|
|
|
I need to print a metafile which I have in memory. There are basically two parts to the question, one being a current problem and one I can see loking ahead.
I've got a DC so all I need to do is pDC>PlayMetaFile(hMyMetafile, &rc)
right? That kind of works, but the resulting image comes out much buigger than it should be. Why? Is it because the rectangle that I am passing to PlayMetaFile is the usable drawing area from the CPrintInfo and not the size of the metafile? Because the mapping mode means the interpretaion of whatever I send it is incorrect?
Second point - If the metafile is wider than the page, how do I print the remainder of the metafile on the second page (if that makes sense)? Presumably I have to set pInfo->m_bContinuePrinting to FALSE so that OnPrint gets called again, but then how do I get the piece of the metafile which was not printed in the first time around to print this time? I can't just call PlayMetaFile again. Can I?
Thanks to anyone kind enough to throw a nugget of wisdom my way!
|
|
|
|
|
First off, you need to know how big your metafile is. If you're gonna scale the metafile to be as [wide|tall] as the page you are printing it on, then be sure you preserve the aspect ratio. Yes, you'll need to pay attention to the mapping mode to know how to convert the measurements when calculating the drawing rectangle. Finally, assuming you know how big the page you are printing onto is, you can simply adjust the [top|left] of the drawing rectangle by that amount when printing subsequent pages.
Shog9
I returned and saw under the sun,
that the race is not to the swift,
nor the battle to the strong...
|
|
|
|
|
hi,
i would like to add a system dsn to the system in the application. i have tried SQLConfigDataSource(). but, it returned "fail" to me.
would anyone give me some insight about this function?
thanks,
jim
|
|
|
|
|
Well, without a code snippet of how you are using the function, a diagnosis would be a guess at best.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Friends,
I need to enable/disable the menu items. For this purpose i am using the EnableMenuItem() function of CMenu class.
The problem is that this function takes input the menu item's ID. But, there are menu items known as "Pop Up Menu Items " having no ID.
How can i enable/disable, popup menu items.
|
|
|
|
|
Hi,
take the parameter MF_BYPOSITION
e.g.
CMenu::EnableMenuItem(2, MF_BYPOSITION | MF_GRAYED);
-> disabled / grayed the third menu item.
Regards
Frank
|
|
|
|
|
thanks for your reply,
I am still having a problem...
In the solution you given, the top menu items are getting disabled. But i want to disable the cascaded menu item.
Example if you have MSN messenger, see the menu item "My Status" from file menu. This is cascaded menu item. How can i disable such menu item.
|
|
|
|
|
You need to know the ID of the first item in the cascaded menu. If you have a UI handler for it, you'll see that it's called twice, first for the menu, then for the option itself.
The trick is to check the CCmdUI object's m_pSubMenu field. This will be null if it's a menu item, and non-null if it's a submenu. In the latter case, you'll need to do something like this;
pCmdUI->m_pMenu->EnableMenuItem(pCmdUI->m_nIndex, MF_BYPOSITION|MF_GRAYED);
to gray it out, as the normal Enable member won't hack it.
This was in the MSDN's C++ Q&A column a while ago
Steve S
|
|
|
|
|
i am using the machine generated Code for the MS Command button (ActiveX).
When developing under WinNT4.0 there was no problem in Setting the Picture Path in the Properties to a BMP File and é voila, the dialog showed up with a bitmap button.
Now i am developing under Win2k, and everytime the dialog with the buttons intialises, the code crashes. Without the Bitmaps it works perfectly. Checking the Source i would manually load the bitmaps to the buttons (hoping that this might work).. i would like to load bitmaps from an Resource ID.
My Problem right now is that it needs an IDispatch*. I guess that i need a CPicture Object (casting it to an IDispatch*), but i can't find any constructor which would take an id, or a CBitmap or sthing like that.
Can anybody help?
Thanks in advance,
Bernhard
"I'm from the South Bronx, and I don't care what you say: those cows look dangerous." U.S. Secretary of State Colin Powell at George Bush's ranch in Texas
|
|
|
|
|
Hi, i followed this link to have a dialog with scrollbars:
http://support.microsoft.com/default.aspx?scid=kb;en-us;262954
This was pretty good .. when you resize it, it will have scrollbars.(Horizontal Scroll & Vertical Scroll)
But this doesn't take away the need of having to scroll already when the dialog is shown. Let's suppose the dialog is too big to fit in the screen, how can i make sure there are already scrollbars on it?
Best regards
Jens
|
|
|
|
|
I'd like to make a desktop resident program, something like a calendar that sits on your desktop that you can click on to add notes or appointments. I've seen them before (in fact i have one that I use) but my biggest problem is that I don't know where to start... Basically, how would I go about creating a window to place on the desktop that doesn't have any titlebar or border? I'd like to make the background transparent such that the month/year text and date text will appear to be directly on the background, and the user can click on any given date to add a note for that day. Eventually I want to add functionality to change the month manually and do re-occuring events etc, but that's down the road. I'd like this to work on at least WindowsXP.
I've successfully made a layered window and made the background transparent (technically everything white is transparent, which includes part of the titlebar), but the titlebar and border are still visible. I don't necessarily need actual code, but I have no idea how to start this off. I've done Win32 and MFC stuff before, but nothing like this. Thanks!
- Allyn
|
|
|
|
|
go th ethe dialog properties->styles
check off the title bar and select border as none
|
|
|
|
|
Sir,
Thanx for giving me such a nice way to interact with u. I am a student & i encountered a problem i m using “Kodak Image Edit ActiveX Control” [WINNT,VC6.0]
i have created a dialog based application to create this control at runtime on click of a button. It will create the control dynamically with image. Sir I want message handler (onLButtonDown, onRButtonDown etc.) on that control at runtime to call the functions of the control class “CImgEdit” like Flip(), SetImageControl() etc.
Instead I have called Flip() function on the message handler onLButtonDown of Dlg class (just 4 trial)now if u click wherever on dialog the image will be flipped .
Moreover, if there are multiple buttons, each creating control dynamically with different images on it, then how the message handlers of each control will be managed separately.
Thanx again for the cooperation
Saadyah Nisar
|
|
|
|
|
Sir,
I am developing a socket program..
i want to transfer a set of files in a particular folder.
i want to transfer the files from server to client and also
i am going to display the filenames in that folder.
so, what function i have to use for that...
can, anybody tell me the solution..
Thanks in advance,
Kuttipa.
|
|
|
|
|
Hi,
U open first a tcp or udp based connection between the server and client.
If ur files are fixed (for transer) U can send them after establishing the connection (using send (tcp) or sendto(udp)). If you want to give the files choice to the User you have to provide a User Interface for selecting the files. You have to write quite a bit of code for all these things. Not possible with a function.
Satya
|
|
|
|
|
Guys i am having a problem using Visual C++ 6 and 7 both.
I create a menu and assign hot key to menu item, like &line, &circle e.t.c, the hotkeys are visible at design time on menu template. But when i run my application, the hot keys are not visible
Similarly, if i generate a SDI application using wizard, and simply Compile and Run it, then at run time the hotkeys of menu items are not visible.
Can anyone tell me what is the problem...
|
|
|
|
|
Press the 'Alt' key and release, then you would be able to see the hot keys.
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
Hello, gurus! I try to hooking TextOutA,TextOutW,ExtTextOutA,ExtTextOutW in a Dialog using Microsoft Detours. And turn the string to uppercase before display it.
It works fine in the client area, such as button control,static control and etc. But the Dialog's caption and menu is still in lowercase. Why?
//dlg.cpp
DETOUR_TRAMPOLINE(BOOL __stdcall Real_TextOutA(HDC a0,
int a1,
int a2,
LPCSTR a3,
int a4),
TextOutA);
BOOL __stdcall Mine_TextOutA(HDC a0,
int a1,
int a2,
LPCSTR a3,
int a4)
{
BOOL rv = 0;
char *p = _strdup(a3);
_strupr(p);
rv = Real_TextOutA(a0, a1, a2, p, a4);
free(p);
return rv;
}
CMyDlg::OnInitDialog()
{
DetourFunctionWithTrampoline((PBYTE)Real_TextOutA,
(PBYTE)Mine_TextOutA);
return CDialog::OnInitDialog();
}
|
|
|
|
|
currently my brush is red in color....and it paints something on background.... now i want to repain the ssame area that i painter red WITH A INVISBLE COLOR...that is i want the user to be able to see the background again....
can ayone tell me how do i get a INVISIBLE COLOR please?????
tks a lot...
|
|
|
|
|
Use the XOR property while painting
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
huh????
how to do that?????wat are u talkin about????
With Regards
Joseph R. Thomas
Have a Super Blessed Day!
-------------------------
For God has not given us a spirit of fear, but of power and of love and of a sound mind.
2 Timothy 1:7
|
|
|
|
|
If you are painting the window using BitBlt( ... ) API, you can probably use the PATINVERT attribute for dwRop value.
See this link
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/bitmaps_0fzo.asp
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|