|
Thanks a lot for you help. I really appreciate it.
Dave
|
|
|
|
|
I want to check the windows login user in my MFC application. How could i retrieve it.
|
|
|
|
|
|
I wish you can give me some suggestions. Thanks a lot!!!
|
|
|
|
|
Hi,
I'm having a problem with posting a user message. My property page can't receive the message. However the main frame can receive. Need your expert advise.
Thanks,
NadAzur
|
|
|
|
|
To whome are you posting the message to? Did you add the message map for the user event in the .cpp file.
Prakash,
India.
|
|
|
|
|
Hi,
Yes, I've added the necessary message map. Message is meant for a property page of my GUI (Single Document).
Regards,
NadAzur
|
|
|
|
|
Ok thats good, now only problem is to whome are you posting the message ?
Still Alive!!!
Thank you God.
|
|
|
|
|
OK, I'm posting the message to the GUI WndApp HWND where the property page belongs to. Is this OK?
|
|
|
|
|
Nope, not correct, if you have posted the message to the frame then it will recevie the message, you can do one thing you can use SendMessageToDescendants api to propogate the messages to its child. But take care that all the childs of the message will recive the message. But if you want to target only the property sheet then you need to post the message to the windows handle of the proprtysheet.
Still Alive!!!
Thank you God.
|
|
|
|
|
Thanks, I'll try it out.
|
|
|
|
|
Hi,
I am struggling to create a decent-looking toolbar using the Windows API with no MFC (it may well be easier with MFC if you know it, but I have yet to plough through my MFC books and I don't want to port the whole of my nearly-finished current project).
After struggling for a couple of days to get a 'flat' look (using TBSTYLE_FLAT) without having all the buttons become transparent, I discovered that to get the look I wanted, I needed to use Rebars. I used the code from MSDN (here) to create a test rebar, and it gave me the look I wanted - except that it is still screwy in another way (probably because MSDN assumes two other functions that it doesn't provide - CreateToolBar() and CreateComboBox()). Essentially, I want two rows of toolbars, so I figured that I would need to create two toolbars and two 'bands' in my rebar to hold them (ie. two calls of RB_INSERTBAND with the RBBS_BREAK style. I have successfully set up my test proggy so that it has two bands of the correct size, but the problem is that the toolbar buttons that should be on the second band aren't in the right place - they overlap the toolbar buttons on the first band (ie. both toolbars seem to have been created at window co-ords 0,0).
I can better explain what I mean by posting a picture:
Picture Here
The CPP file for this test proggy can be downloaded here - this is the only file of the project, so can be compiled to the test prog. It's messy because it's just a test program that I threw together to try and get rebars and toolbars working. CreateRebar() was ripped from MSDN, with only minor modifications. The problem might be there, or it might be in CreateToolBar() (which creates a toolbar with three text buttons) or CreateToolBarIcons() (which creates a toolbar with some standard Windows buttons). I've stared and stared, experimented, tested and generally poked around, but I just can't see what I'm doing wrong.
If anybody has a chance to scan these functions to see what my mistake is, or just make some suggestions as to what you might think the problem could be, I would really appreciate it. Obviously I don't expect anybody to debug my code - I only attach the CPP file because it is easier than posting three long functions here.
Many thanks to anyone who can help,
KB
|
|
|
|
|
P.S. Depending on what version of comctl32.lib you are using, you may have to change MIIM_STRING to MIIM_TYPE to get main.cpp to compile - or just comment out the whole of CreateMenu() as it has nothing to do with my toolbar problem anyway.
Any replies or help much appreciated!
Many thanks,
KB
|
|
|
|
|
Has anyone seen an implementation of an outlook bar control but that is horizontal, not vertical? An example of a vertical one is:
http://www.codeproject.com/cs/miscctrl/csoutlookbar.asp?target=outlook%7Chorizontal
I am looking for this control written in C++ not C# but would take either.
Thanks
Ralph
|
|
|
|
|
I have a CButton-derived class that is owner-drawn and has data members for a pointer to a CImageList and an index to select which image in the list to display. The bitmap resource that is used to create the ImageList is 8-bit and uses green as the background color to be masked. When I draw the images onto the button, the transparency mask works great, but the rest looks bad, like it might be a 4-bit image? Yet it looks fine in the resource editor. I'm missing something crucial.
Thanks in advance for any advice.
Tym!
Here's what I'm doing more or less:
The image list is created from a resource: an 8-bit bitmap strip with a green background for the masked transparent color:
<br />
CImageList _defaultImages;<br />
_defaultImages.Create(IDB_BITMAP_RESOURCE_ID, _imageWidth, 32, 0x0000ff00);<br />
The Button is created dynamically:
<br />
#define BTN_STYLE BS_PUSHBUTTON|WS_VISIBLE|WS_TABSTOP|WS_CHILDWINDOW|BS_NOTIFY|BS_OWNERDRAW<br />
...<br />
CMyButton* _myButton = new CMyButton();<br />
_myButton->Create("",BTN_STYLE,_buttonRect,this,3999);<br />
_myButton->SetImageList(&_defaultImages);<br />
_myButton->SetImageIndex(DEFAULT_IMAGE);<br />
and I am drawing the image like so:
<br />
void CMyButton::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) <br />
{<br />
<br />
CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);<br />
UINT state = lpDrawItemStruct->itemState;<br />
...<br />
if (_imageList != NULL && _imageIndex != -1)<br />
{<br />
CPoint _location(2,2);<br />
if (state & ODS_SELECTED)<br />
_location.Offset(1,1);<br />
<br />
this->_imageList->Draw(pDC, _imageIndex, _location, ILD_TRANSPARENT);<br />
}<br />
...<br />
}<br />
|
|
|
|
|
I found it.
When creating the imagelist directly from the resource, the ImageList defaults to 4-bit apparently. So I has to do it the long way:
<br />
CBitmap _imageBitmap<br />
_imageBitmap.LoadBitmap(IDB_BITMAP_RESOURCE_ID);<br />
<br />
CImageList _defaultImages;<br />
_defaultImages.Create(_imageWidth, _imageHeight, ILC_COLOR32|ILC_MASK, 1, 32);<br />
_defaultImages.Add(&_imageBitmap,0x0000ff00);<br />
This will create a 32-bit imagelist with a green mask from the resource.
|
|
|
|
|
Hello,
I create dynamic Window triggering on a mainframe event using:
CMDIChildWnd::Create(lpszHelloClass, szTitle, style, rect, parent);
As I create each new window, I want to load a dialog resource, the same resource for each new window.
How do I do this? I will be adding an ActiveX control to the dialog.
Thanks.
Jerry
|
|
|
|
|
You can create a CDialog derived class holding the functionality of the dialog resource. Ofcourse you should be having the resource id of the dialog at compile time itself for doing this.
After this you can use one of your events to invoke this dialog by calling CDialog -- DoModal().
You can probably refer this link to get some more ideas.
http://www.codersource.net/codersource_mfc_prog.html
This might give you some idea.
|
|
|
|
|
Does anyone know of a library for loading (and possibly displaying) MS PowerPoint files? I need more control over the presentation than COM allows.
Thanks,
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
You could host it in a WebBrowserCtrl.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
I am using a manifest to load Comctl32 v6 when the application is loaded on Windows XP. However, I get a weird paint problem when I use AppName.manifest.exe vs. when I don't use it.
http://www.sagara.org/goodbad.gif[^]
(Good == without AppName.manifest.exe; Bad == with AppName.manifest.exe)
Has anybody seen this behavior before?
|
|
|
|
|
Yeah, it's a known issue. I'll bet you're using VC6 ?
You need to send the toolbar a WM_NCPAINT message when it re-paints itself:
::SendMessage(m_wndToolBar.GetSafeHwnd(), WM_NCPAINT, 0, 0);
|
|
|
|
|
LunaticFringe wrote:
I'll bet you're using VC6 ?
Indeed I am. Is this specific to VC6? Do you by chance have a link to a KB article?
BTW, thanks for the response.
|
|
|
|
|
No, I don't have a KB. I meant it was known to me. (Big whoop, says Jon.)
No, trivial as this seems, it was one of the final straws in convincing me to upgrade to VS.NET 2003. This isn't a problem there.
If you use toolbar customization, though, this is still a problem, even in MFC ver. 7.1. They fixed the regular paint problem, but not one that occurs when the bar is resized as buttons are added or removed. Same fix applies - you just add a NCPAINT call.
You might try deriving a class from CToolbar and adding this to the WM_PAINT handler.
<edit>
Naa, forget that suggestion. You'd have to make (well, should make) the execution conditional on it running on an XP box, using themes, and all the rest of it. Nope, you're looking at just what I was looking at. Either upgrade or abandon the use of themed controls.
</edit>
|
|
|
|
|
I have a C# application where I want to allow runtime resizing and moving of controls. The functionality that I need is encapsulated in the C++ class CRectTracker. I need to reference the MFC library, but also provide a callable interface from C#. I have tried to create a managed C++ dll, but it does not create the linkages to the MFC library. Would it be better to create an MFC C++ dll, and then wrap the interface with managed extensions? I'm not sure how to go about the second option. How do I reference a CWnd object from C#? Any help would be appreciated.
|
|
|
|