|
I want to learn how to make my own custom shaped dialogs, much like Windows Media Player[^] does, with it's own user-defined edge.
I'd search for topics here at CP, but I do not even know what the technique is called, making it hard. I figured it had something to do with transparency, so I search for that keyword, but nothing obvious surfaced. Anyone know a good article I ought to read? I'm just looking for some direction.
Edit: I'd like something in MFC, if at all possible... and if not possible I'd like to know why?
: Dean 'Karnatos' Michaud
|
|
|
|
|
Check out this article for a way to get started:
http://www.codeproject.com/dialog/message_balloons.asp[^]
Remember that MFC is a class library wrapped around the Windows API. AFAIK, Windows doens't natively support dialogs that aren't square, so you have to write custom code to do it, so it is unlikely that this will get into MFC anytime soon.
Even a broken clock is right twice a day.
|
|
|
|
|
Beautiful... Most appreciated!
: Dean 'Karnatos' Michaud
|
|
|
|
|
Navin wrote:
doens't natively support dialogs that aren't square,
It certainly does, check out SetWindowRgn().
--Mike--
"alyson hannigan is so cute it's crazy" -- Googlism
Just released - 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
try: http://www.codeproject.com/gdi/coolrgn.asp[^]
It allows you to create a region to use with SetWindowRgn (as Michael Dunn suggestion below) from a bitmap file.
I use something similar for my funky non-rectangle app.
That's why I ramble so much. If you're short and quotable, there's a much greater danger of ending up in a sig.
[Christopher Duncan on how to prevent yourself from ending up in a sig]
|
|
|
|
|
As an example, there is a project posted here on codeproject (by John Roark) that displays a "skinned" dialog (sorry I don't have the link at this time). If I try to add a CStatic derived class to it, I keep getting link errors (see below). I am using the "Use MFC in a static library" option. Using a shared dll option does not produce the error, but I need to have the static library option.
Every search I do keeps telling me that I can solve this error by selecting one of the Multi-Threaded options in the "Code Generation" tab of VC6. The thing is - I already have the Multi-Threaded option picked.
I'm really hoping that this is a very simple problem to solve, but I'm stumped.
Any ideas?
Thanks,
David
Link errors:
nafxcwd.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z) already defined in LIBCMTD.lib(new.obj)
nafxcwd.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) already defined in LIBCMTD.lib(dbgdel.obj)
Debug/SkinTrial.exe : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.
|
|
|
|
|
Are you linking to any other static libraries? They will also need the same settings.
One other thing - sometimes it is easer not to fight these types of errors and create a clean project from scratch. In other words, create a new project (DSP), making sure to select that you are using MFC statically. Then add your files, making sure things still compile. Chances are this will work, or at least help you narrow down the culprit.
Even a broken clock is right twice a day.
|
|
|
|
|
You probably need to do some more. There is an article in MSDN that describes what you have to do to add MFC support to an ATL project. It is pretty generalizable advice.
Search for "Howto MFC ATL" to find the article.
|
|
|
|
|
Hi there,
Is there any function in CDaoRecordset class that check the field value ...
I mean just check Is the field empty ?
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Does anyone know what algorithm FindString uses? This function does not work like I think it should. I am allowing a user to select an item from a list and add the item to another list. I don't want duplicates added to the second list so I use FindString to determine if the selected item is already in the list.
Simple enough.
Or so I thought. An example:
If I add the string "cutset2" to the list, then try to add the string "cutset" to the list...FindString tells me that "cutset" is already in the list. If I reverse the order and add "cutset" then "cutset2", FindString works properly.
Does anyone know why? Is this standard behavior? Is there any way around it, besides writting my own FindString function?
Gary Kirkham
A working Program is one that has only unobserved bugs
|
|
|
|
|
Nevermind...FindStringExact does what I want.
Gary Kirkham
A working Program is one that has only unobserved bugs
|
|
|
|
|
Please, help me with that stupid problem...
I want to format a string and then display it in an Edit box like that:
for(int i=0; i<m_sztext.getlength();i++)
{
="" if(analyzechar(m_sztext.getat(i))="="letter")
" str="" +="m_szText.GetAt(i);
" here="" is="" the="" problem="" -="" i="" want="" to="" have="" new="" line,="" but="" string="" formatted="" like="" that="" :="" instead="" of="" line="" symbol="" written=""> |
I have tried the following formatting too: str+= "\n" and it didn't worked too */
}
m_wndResult.SetWindowText(str);
I would be very grateful to any solutions of the problem!
Thanks in advance
P.S. May be the problem is in SetWindowText() ????
|
|
|
|
|
str += "\r\n" ; for a new line in an edit control
CString letters("ABCD...XYZabc...xyz") ;
if (letters.Find(m_szText.GetAt(i)) >= 0)
if (m_szText.GetAt(i) == ' ')
Roger Allen
Sonork 100.10016
I have a terminal disease. Its called life!
|
|
|
|
|
Hi all,
I'm trying to determine when a removable disk is inserted by the user.
I have tried using the WM_DEVICECHANGE message (to my top level window) however this message is only being sent when a CDROM is inserted or removed.
I need to determine when a zip disk (or media card which behaves the same way) is inserted... Any ideas?
I've tried getting a handle to the drive letter and registering a notification request but without success.
Any help appreciated.
--
The Obliterator
|
|
|
|
|
I encounterd such problem with DVD RAM drive. It looks like the driver doesn't support notifications. Even their own programs (such as DVD Format) don't recognize when DVD media is mounted or unmounted. I didn't find solution and implemented the stupid check of drive state by timer.
|
|
|
|
|
Well I've found a way that works for me, courtesy of an example from Sameer Maggon and msdn.
It detects any removable media being inserted such as a zip disk or the media cards I am interested in.
I think it should work for your DVD RAM drive also, providing the shell is aware of the change.
I've posted an article here on CP which may be of use to you:
http://www.codeproject.com/useritems/SHChangeNotifyRegister.asp[^]
--
The Obliterator
|
|
|
|
|
Okay, I posted a message about getting the icon from an .exe. I was told to look into ExtractIcon and ExtractAssociatedIcon. But I have another question. What do I do to apply this icon to a button? I currently have several buttons on a toolbar and each button has an associated bitmap, that I created in the resources. Now, I need to pull off the icon from an .exe file and use that as my toolbar button bitmap. What do I need to do? I am clueless...
I am putting my original posting below, just in case someone needs a little more info on what I am trying to do:
"I am trying to do something and the part that sounds the simplest is turning out to the hardest. I am putting a button on a toolbar. What this button will do is allow a user to set the button up to point to an executable. For instace, if the user wants this button to launch solitaire, it goes through the process of having the user find the .exe file. This is simple. The hard part is I am trying to use the icon from the .exe file as the bitmap for my button. And I cannot figure out how to do it. Any ideas? I have looked on this website but haven't found anything, it might be that I don't know where to look exactly... "
|
|
|
|
|
This sounds really interesting. When you figure this out, post the solution as an article on CodeProject.
- Kevin
|
|
|
|
|
Toolbars can pull the images for their buttons from either a bitmap (as you are doing now) or from an image list. If you use an image list, you can easily add icons to it dynamically and cause buttons to display them; see the Toolbars & Docking Windows section here for more information on how to use image lists in toolbars.
Shog9
------
Sitting in muddy water
isn't such a bad life,
if it ends after the first time... - Yoko Kanno, The Real Folk Blues
|
|
|
|
|
I have looked through most of the articles but I could not really find anything that will work. Unfortunately, my project is written in C, not C++ nor MFC. Many or most of the articles reference classes, which I cannot use. So I am still lost. I undestand how to get the handle to the icon, just no clue how to apply it to my toolbar. Any other ideas?
|
|
|
|
|
CarpeDiem wrote:
Many or most of the articles reference classes, which I cannot use.
Well, you'll just be writing more code yourself then; it's all the same in the end. How are you creating and initializing your toolbar now?
Shog9
------
Sitting in muddy water
isn't such a bad life,
if it ends after the first time... - Yoko Kanno, The Real Folk Blues
|
|
|
|
|
This is a little tough to describe. The main toolbar has bitmaps that are contained in the resources. When the app is launched, there is a function that someone created that loads all the bitmaps. There is another function, similar to TBADDBITMAP, with a few minor changes. The toolbar window itself is created with a CreateWindow and uses a class (which I do not have access to). The buttons are added one at a time. So, I have to call a function to add the button, even though I don't have a bitmap, so the button is blank. I am sorry for not being overly descriptive, I don't have access to all the code to see the exact details of how it is getting loaded...
|
|
|
|
|
Alright, well this needs some clarification yet, but here are your options from what i can see:
If you are using standard Win32 toolbars (CreateWindow(TOOLBARCLASSNAME, ...); , then you can easily convert your existing code to work with image lists, which makes dynamically adding icons trivial.
If you are using some other toolbar class, then all bets are off; you'll need to find out what's possible. If it turns out you need to have all the buttons in one big bitmap that's created when the toolbar is initialized, things get a bit more tricky. But it's still possible to get it working, you'll just need to figure out how many icons you want and draw them onto the bitmap prior to adding it to the toolbar.
Shog9
------
Sitting in muddy water
isn't such a bad life,
if it ends after the first time... - Yoko Kanno, The Real Folk Blues
|
|
|
|
|
From my understanding (and looking at the code), the main toolbar is created through a CreateWindow(TOOLBARCLASSNAME, ...); What happens is that each individual bitmap that is used for each button is actually contained within 1 file. There are about 39 bitmaps stored within this one file and is assigned at run time. For instance, the toolbar is created and then SendMessage(hwndTask, TOOLBARADDINGFUNCTION, 120, IDB_BUTTON_TO_ADD) is called. This is what actually assigns the bitmap to each button, the 120 is the position the bitmap is stored at. Did this help at all?
Sorry for the different username, I am using a friend's computer to reply and I just noticed he was logged in as his username.
|
|
|
|
|
I don't have any example code at hand right now (at home, eating ), but here's the process in a nutshell:
- Create the toolbar with
CreateWindowEx(0, TOOLBARCLASSNAME, NULL, WS_CHILD|WS_VISIBLE|TBSTYLE_FLAT|TBSTYLE_WRAPABLE, 0, 0, 0, 0, hwndParent, (HMENU)ID_TOOLBAR, hInstance, NULL); or similar. - Use
ImageList_Create() to create an image list of the appropriate size for your bitmap. - Use
ImageList_Add() or ImageList_AddMasked() to add bitmaps to the image list. Use ImageList_AddIcon() to add icons to it. - Send the
TB_SETIMAGELIST message to the toolbar, associating the image list with it. - Send the
TB_BUTTONSTRUCTSIZE message to the toolbar, informing it of the size of the TBBUTTON structure you'll be using. - Send the
TB_ADDBUTTONS message to the toolbar, adding buttons as necessary.
This leaves out a lot of detail, i know, but give a look through MSDN for each step, and i think it'll make sense. If not, post back tomorrow & i'll see what i can do.
Shog9
------
Sitting in muddy water
isn't such a bad life,
if it ends after the first time... - Yoko Kanno, The Real Folk Blues
|
|
|
|