|
|
If I understood u correctly,
str="david";
So u need to
str = "C:\\" + str + ".dat";
and then
pFile=fopen(str,"r");
RIGHT?
/\|-||\/|/\|)
|
|
|
|
|
better convert it to char* then use fopen,
and more over, u cant use two "+"s in CStrings,
try like
str +="david";
str +=".dat";
V
|
|
|
|
|
Vivekuniq wrote:
and more over, u cant use two "+"s in CStrings,
yes you can, because there are global operators + which take CString parameters...
the only requierement is that one of the two operands of the + must be a CString.
"c:\\" + str + ".dat" is correct so...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
tres bien toxcct !!
V
|
|
|
|
|
If both sides are char* then you can also do this:
char * first = "first";
char * second = "second";
CString str = CString(first) + second;
[EDIT]
I see there was some confusion about this post. So, for anyone looking at this the first time will understand better:
At first glance it may seem that I'm adding two char* pointers together. But in reality it is not. The "first" string is being converted to a CString using a temporary object and then the CString addition operator is being called to append the second string. Finally the resulting CString (first and second combined) is assigned to "str".
|
|
|
|
|
Bill Buklis wrote:
If both sides are char* then you can also do this:
your assert is not really correct. by explicitely creating one CString as operand of the operator +() , it doesn't see two char* anymore. the compiler sees the operation Cstring+char* and searches for the CString& operator+(const CString, LPCTSTR) ...
which come back to what i said previously :
at least one of the 2 operands of the operator + must be a CString...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
I never meant to imply that some conversion wasn't necessary. You're absolutely correct that one of the operands must be a CString. I was merely showing an alternative approach that doesn't require declaring another variable. At the end, both are essentially the same thing.
|
|
|
|
|
Hi
I have created a new Icon image for my program. I set the small icon and big one to my new icon and everything work fines. The problem is when i open the folder containing my exe file (inside debug):
If i chose view -> Large Icons, i see that my app has my new icon
BUT IF I CHOSE view -> Small Icons or List or Details, i see that my app icon is not my new one but the standard MFC blue icon.
How can i change that?
/\|-||\/|/\|)
|
|
|
|
|
good question..! but no clue
V
|
|
|
|
|
In the Icon editor, you'll need to edit both the large (32x32) and small (16x16) images. It sounds as if you've changed the 32x32 image, but not the 16x16 one. An icon can contain multiple images, at different sizes and colour depths, and if you edit the icon, you have to edit them all.
|
|
|
|
|
I don't understand
In the Icon editor there is only one icon so i edited it
/\|-||\/|/\|)
|
|
|
|
|
Ah Ok man thx a lot ur the man
But u should do one more thing:
remove the following command: SetIcon(m_hIcon, FALSE);
/\|-||\/|/\|)
|
|
|
|
|
Halawlaws wrote:
remove the following command: SetIcon(m_hIcon, FALSE);
why removing such a code line, that was generate by the wizard ???
it is there to draw the icon in small or high size depending on the program state (size of the window)...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
toxcct wrote:
why removing such a code line, that was generate by the wizard ???
Coz if u dont it wont work
da
/\|-||\/|/\|)
|
|
|
|
|
it's always been morking for me...
i think you've broken one more thing, because it should work without removing that line...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Gotcha!!.. got the remedy for ur ICON problem,
on the resource tab..right click on the "IDR_MAINFRAME" icon.. see its property,
its just accessing the ICON from /res/myapp.ico.. ("resource directory")..
So go to your project folder,
open the "res" folder,
Replace the "default" MFC icon there with your Colorful ICON
then Bulid your project,
now no problem which mode u select to view your folder, the icon'd be the same..
try and reply..
V
|
|
|
|
|
No man still the same problem.
I think by defult the MFC draws the small icon stored in the registry.
Thx for trying though
/\|-||\/|/\|)
|
|
|
|
|
No, it doesn't. As mentioned above the same IDR_MAINFRAME icon in your resource contains both the large and small icons. To switch between them in the resource editor:
Open the icon to edit
From the Menu highlight Image/Current Icon Type. An additional menu should open showing you all of the different images for this one icon resource. Click on the selection you wish to edit.
If this is a new MFC project using VC++.Net, you may icons for several different sizes and bit widths, e.g. 16x16 16 color, 16x16 256 color, 32x32 16 color, 48x48 true color, etc.
You will need to edit each one individually. You may also choose to just delete the extra ones that you don't need. At the very least keep the 16x16 and 32x32 16 color versions.
|
|
|
|
|
Thx man
It finally worked
/\|-||\/|/\|)
|
|
|
|
|
Hi, i am newbie and want to know :
How can i create a Owner Draw Menu
I did it easily with buttons , choosing Owner Draw property in the properties dialog box. But cant do it with menus
thanx
|
|
|
|
|
|
Hi guys,
i had posted this question two weeks ago but did not get any useful reply that would help me , so sorry for the repeated post
I am writing a simple application similar to Spy++ Utility , that displays different information about chosen window.
I want to draw that black rectangle(like in Spy++) over windows ,when mouse is over that window. I manage to draw it , but when i move mouse to another window the rectangle stays on the previous window and on the new also.
I used to store previous windows and when the mouse was over new window i was simply sending the Invalidate() function to the previous window.
For some strange reasons this worked on 95% of the windows , but there were some areas where the rectangle stayed partialy.
Can anyone suggest me any another way of achieving this??
Best Regards
"Success is the ability of going from one failure to another with no loss of enthusiasm" - W.Churchill
|
|
|
|
|
why don't you knock up a quick app that logs all messages it gets, then use Spy++ on that app, and see what messages spy++ is using to force redraw. Then do that in your app.
out of interest, what will your app do that spy++ doesn't?
using System.Beer;
|
|
|
|
|
Jon Hulatt wrote:
why don't you knock up a quick app that logs all messages it gets, then use Spy++ on that app, and see what messages spy++ is using to force redraw. Then do that in your app.
I haven thought about that i'll try that thanks, but i doubt it uses the same technique as Lim Bio Liong in his article[^], Lim does not redraw the window , he uses Brushes , but i could not implement this in MFC.
So i thought that Invalidate() would help and it does , but as i see i have problems when i move the cursor from a parent window to its child,that's the case when the rectangle partially stays on the parent . But when i move the cursor between Child windows(ex : from button to button,..) it works
Jon Hulatt wrote:
out of interest, what will your app do that spy++ doesn't?
Actually nothing, so far. I decided to do it just for interest
"Success is the ability of going from one failure to another with no loss of enthusiasm" - W.Churchill
|
|
|
|