|
In C ( which C++ is built on ), you use a function called ( I think ) OpenFile, and get a FILE object back. That's what I meant.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Help,
I would like to crop individual elements from an existing "cool" toolbar and add them to the default
toolbar created by an SDI project.
I can't find an easy, straightforward way to do this. I'm using VS 6.0.
Thanks in advance.
Steve
|
|
|
|
|
If you're talking about copying the button images, then a good image editor (Paint Shop Pro, The GIMP, or even Paint in a pinch) is your best friend.
If you want to do it programatically, then check out the ImageList API.
You must be careful in the forest
Broken glass and rusty nails
If you're to bring back something for us
I have bullets for sale...
|
|
|
|
|
Yes. I want to extract selected button images and add
them to the IDR_MAINFRAME toolbar.
I've tried Paint, but only had limited success perhaps
because I'm not adept at using Paint.
Thanks for the reply.
|
|
|
|
|
Hi together - i have a quite simple problem that i can't figure out myself. If searched 3 hours, but didn't find a solution. The problem: i've created a mfc application. I also added a menu to zhe project. Now i want to use the form without a titlebar - and of course - i want to use the menu as a PopUp menu - the problem i have is, that the menu also appears as a normal menu. But thats wrong. How can i hide the menu and make it only a popup menu? Thx!
JR20!
JR20
|
|
|
|
|
Sorry - was my fault - i assigned the menu with the dialog -> just stupid - sorry!
CA - Have a lot of fun...
JR20
|
|
|
|
|
Hi all,
I'm trying to set the give time zone as my local time zone..
but the time that I suppose to get is totally wrong.
let say.. my local time is
currentLocalTime = 5:30 pm 05/26/2005
gmt = +5;
how can I set the local time to that gmt= +5 time zone and then reset it back to original time zone?
the following is my testing code.
<br />
SYSTEMTIME sysTime;<br />
SYSTEMTIME sysTime1;<br />
int gmt;<br />
<br />
COleDateTime formatedDateTime;<br />
COleDateTime currentDateTime;<br />
::GetLocalTime(&sysTime); <br />
currentDateTime.SetDateTime(sysTime.wYear,sysTime.wMonth,sysTime.wDay,sysTime.wHour,sysTime.wMinute,sysTime.wSecond);<br />
CString temp = currentDateTime.Format("%m-%d-%Y %H:%M:%S %p");<br />
<br />
gmt = atoi(selectedTimeZone); <br />
COleDateTimeSpan timeSpan(0,gmt,0,0); <br />
<br />
formatedDateTime = currentDateTime - timeSpan;<br />
sysTime1.wDay = formatedDateTime.GetDay();<br />
sysTime1.wHour = formatedDateTime.GetHour();<br />
sysTime1.wSecond = formatedDateTime.GetSecond();<br />
sysTime1.wMinute = formatedDateTime.GetMinute();<br />
sysTime1.wYear = formatedDateTime.GetYear();<br />
sysTime1.wMonth = formatedDateTime.GetMonth();<br />
<br />
::SetLocalTime(&sysTime1); <br />
::GetLocalTime(&sysTime1); <br />
currentDateTime.SetDateTime(sysTime1.wYear,sysTime1.wMonth,sysTime1.wDay,sysTime1.wHour,sysTime1.wMinute,sysTime1.wSecond); <br />
CString temp1 = currentDateTime.Format("%m-%d-%Y %H:%M:%S %p");<br />
<br />
::GetLocalTime(&sysTime); <br />
currentDateTime.SetDateTime(sysTime.wYear,sysTime.wMonth,sysTime.wDay,sysTime.wHour,sysTime.wMinute,sysTime.wSecond);<br />
temp1 = currentDateTime.Format("%m-%d-%Y %H:%M:%S %p");<br />
|
|
|
|
|
hm, at first, you didn't change the timezone in the computer - in the best case, you only mixed-up with the current time (which is still in your local timezone).
Second - adding offset in the hours does not always mean switching to another timezone - you have to think about summer time/winter time issues (although this is adding the hour offset as well, but different time offset in different time)
You have to realize is that stuff like local time and changing the timezone will affect other programs, and they have no idea that something like that is happenning
Anyway, what I don't understand is why you want to switch to some timezone and then back to the original timezone.
|
|
|
|
|
Thank you for your reply Geo,
Well.. I have to find out what is the time for given time zone (GMT +/-).
I though, get the local time, use COleDateTimeSpan() then I will get the time from the time zone I want. But I didnt' get it.
I have to read the emails.. the emails might be sent from LA, US. or could be from Tokyo. I know the GMT for Japan is +9 so.. I need to convert the sent date time from LA (local) to Tokyo time. I'm using MS Outlook to open the msg files, sometime .pst files.
I was thinking of changing my time zone in my computer system, so I dont' have to change the date and time all the time for every single email. Then change the time zone back to my local time zone after I finished using MS Outlook.
Thank you.
|
|
|
|
|
Hi, changing the global setting like the computer's current time zone is a bad thing, because it can affect other programs and lead to some even serious problems. Problem is that the timezone is a setting for all programs running under the user profile - if some program relies on the time, it can be wrong in that time (especially if it doesn't handle correctly change of the timezone in runtime)
If you know the correct time offsets, you can use the COleDateTimeSpan , it should work - but you have to convert it twice as the GMT+/- offsets are relative to the GMT - so if you have e-mail from Japan (+9) you have to subtract 9 from the time and you'll get the GMT. Then you have to add offset of your timezone (or use any function that returns local time from the UTC/GMT time) to get the local time.
|
|
|
|
|
We have a subclass of CToolbar and we are using the 'LoadToolBar()' method to create the buttons etc. for the bar from a bitmap image.
My question is, how can I use my own button subclass, instead of CButton for the actual toolbar buttons? In fact, I would like to be able to 'mix' the button objects: CButton, CBUtton, MyButton, CButton etc. within the same toolbar.
My apologies if this has been answered here before in the last 2 months.
Tim
|
|
|
|
|
actually, the second requirement can be dropped. I can separate the buttons in to different toolbars.
|
|
|
|
|
The toolbar control is a single window. There are (by default) no child controls created. What look like buttons are drawn (and the behavior controlled) by the toolbar control itself - no relation to pushbuttons, radiobuttons, etc.
So... You can subclss CToolBarCtrl , and do funky stuff there if you like, or use your own icons and the custom draw API to change appearance. I'm gonna caution you from the outset though - toolbars are a huge, huge annoyance to do custom work with. Don't expect to get some fancy new deviation from the norm implemented and working in an afternoon unless you either buy/borrow the code, or have gobs of experience with the control already. IMHO, it probably has the worst design and implementation of any of the common controls, and each new version of Windows (or IE) brings a new pile of ugly hacks to the mix.
You must be careful in the forest
Broken glass and rusty nails
If you're to bring back something for us
I have bullets for sale...
|
|
|
|
|
Shog9 wrote:
The toolbar control is a single window. There are (by default) no child controls created. What look like buttons are drawn (and the behavior controlled) by the toolbar control itself - no relation to pushbuttons, radiobuttons, etc
This is what I was looking for. That explains everything.
Shog9 wrote:
I'm gonna caution you from the outset
Thanks for the advice. Now that you mention this, I seem to remember hearing this, or something similiar in the past.
Thanks for you help.
Tim
|
|
|
|
|
Hi everybody. This is the most frustrating issue I've ever come across since I'm working with Visual C++. I made this DLL and I'm trying to send a WM_SETTEXT message from it to a VB application but the VB Application never receives the message!! If I send WM_SETTEXT from another VB application to my main VB application, it works. If I send WM_SETTEXT from the application itself to it, it works. I subclassed the window of the VB application so that I can take a look at all messages that go through.
If I send WM_USER from VC++ to VB, it works. If I send WM_SETTEXT from VC++ to VB, it doesn't. What COULD BE GOING ON THERE??????????? I'm totally confused and I don't understand why such a simple thing doesn't work! I tried all sorts of variants but NOTHING works!!!!!
SendMessage(hwndToTheSubclassedVBWindow, WM_SETTEXT, NULL, *"Annoying\0");
SendMessage(hwndToTheSubclassedVBWindow, WM_SETTEXT, NULL, *"Annoying");
<br />
char *c = "";<br />
c = (char*)malloc(256);<br />
c = "This is annoying";<br />
SendMessage(hwndToTheSubclassedVBWindow, WM_SETTEXT, NULL, *c);<br />
Before you say anything. The hwndToTheSubclassedVBWindow is CORRECT. I checked it 100 times.
WM_SETTEXT annoyance table:
same VB -> VB -> works
other VB -> VB -> works
C++ -> VB -> doesn't work
WM_USER annoyance table:
same VB -> VB -> works
other VB -> VB -> works
C++ -> VB -> -> works
Now. If *ANYBODY* has a clue about this, he/she has a gold medal from me! 'Cause I asked in other 2 or 3 forums and nobody knows anything.
-= E C H Y S T T A S =-
The Greater Mind Balance
|
|
|
|
|
Axonn Echysttas wrote:
...but the VB Application never receives the message!!
How are you verifying this?
Axonn Echysttas wrote:
char *c = "";
c = (char*)malloc(256);
c = "This is annoying";
SendMessage(hwndToTheSubclassedVBWindow, WM_SETTEXT, NULL, *c);
How about:
char *c = (char *) malloc(256);
strcpy(c, "This is annoying");
SendMessage(hwndToTheSubclassedVBWindow, WM_SETTEXT, NULL, (LPARAM) c);
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hi David. First things first: I was verifying using my using my own WindowProc that I subclassed from the VB Application. The VB Application had in its own code in a module my WindowProc and I had a message box there to notify me when I get WM_SETTEXT messages. ALSO, I used Spy++ as a last line of defense in case my code was wrong. But my code was ok.
Second things second:
*SHOCKED*
*laugh*
*applause*
You did it!! : D. I can't beleive it!!! You did it! I knew it! This WAS a VC++ issue.
I am sorry, but I am still a beginner in VC++. I jumped directly in Hooking, subclassing instead of starting with the basics. David, you really deserve a gold medal, thanks a lot. This was a huge issue. Now I'm one more step closer to success. Remember me : D. I'll soon finish my freeware software and you'll be in the "thanks to" list, like all the other people from the Code Project and other places that helped me.
I'm very happy that this issue is fixed, but still... WHAT *WAS* my mistake?? Why didn't the messasge get sent?? Was it because I didn't cast to LPARAM? Was it because I... can you explain how you fixed this so easily?
Thanks you VERY much! Wow am I happy to get this out of my hair or what! Pfiu! This issue killed my day and my last night.
Axonn out, going to sleep, it's late and tomorrow I gotta keep pushing ahead. I gotta go to work and when I'll be back home I'll keep working at my freeware soft : D. I can't wait to finish it so I can present it to all you people. This is the first internet place where I'll make it public : ).
-= E C H Y S T T A S =-
The Greater Mind Balance
|
|
|
|
|
Axonn Echysttas wrote:
Was it because I didn't cast to LPARAM?
Yep. The message was expecting the address of a string. You were passing the value of the first character of the string. These are not the same.
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"
|
|
|
|
|
Now I understand why sometimes when I was sending a WM_USER message with some text parameters, in Visual Basic I grabbed an "84" from those parameters. Probably it sent the ASCII code of the first leter in the string.
Hm. Well, don't worry. I learned a lot these past two days.
Thanks a lot to all of you : ). I may finally continue work.
-= E C H Y S T T A S =-
The Greater Mind Balance
|
|
|
|
|
I want to create a bitmap that has text on it. The text will be different everytime the program is executed. The bitmap will then be set as the wallpaper in Windows. I am working with Visual C++ 6. I have found various guides online but none of them seem to work for me. I've been playing around with CBitmaps, GDI, and DCs but I have become completely lost. Can anyone show me a complete example of how to put text into a bitmap and save it?
|
|
|
|
|
See if this article helps.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
This is very helpful but where did u get the value of pDC from?
|
|
|
|
|
It's passed to the view's OnDraw() method.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I want to take the real part from a decimal number for example if i have 3,13 take only the 3. I remenber that there is something to do it but i dont remenber yet Thanks
|
|
|
|
|
#include <math.h>
int nFloor = (int)floor(3.13);
Pssst. You see that little light on your monitor? That's actually a government installed spy camera. Smile and wave to big brother!
|
|
|
|
|