|
Hi all,
I have made a project in VC6 and now i want to convert my project in VC2008..
What i have done is i have simply opened its dsp file in VC2008 enviornment. It asked do you want to convert all the files i pressed yes.
Now its giving a compile time error C2440: 'static_cast' : cannot convert from 'LRESULT (__thiscall CTextProgressCtrl::* )(UINT,LPCTSTR)' to 'LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)'
which is a message map function.
How can i remove this???
Thanks in advance
|
|
|
|
|
I guess you have to change the prototype of the offending method to match
LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)
i.e. Change the last argument type (of the offending method) from LPCTSTR to LPARAM (and then make an explicit cast inside the function).
Please post the declaration of the offending method.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I can't use
int16_t
uint32_t
int64_t
...
Don't VC9 support C99?
|
|
|
|
|
I have a function in my program that processes grades. The function is:
void PrintArray (const int grades[])<br />
{<br />
cout << "The scores are: " << endl << endl;<br />
for(int i = 0; i <= MAX_GRADES; i++)<br />
cout << setw(4) << grades[i] << endl;<br />
}
What I want it to do, is print out the variable 10 per line instead of straight up and down.
I also want to have a const int MAX_WIDTH = 10 so that the function knows when to insert in a newline.
Any help would be greatly appreciated. Let me know if I'm missing information you need to help. Thanks in advance.
|
|
|
|
|
I am not sure if i understood problem but
do you want something like this
void PrintArray (const int grades[])
{
const int MAX_WIDTH = 10;
cout << "The scores are: " << endl << endl;
for(int i = 0; i <= MAX_GRADES; i++)
{
cout << setw(4) << grades[i];
if((i+1)%MAX_WIDTH==0) cout<<endl;
}
}
I hope it helps.
Regards,
Sandip.
|
|
|
|
|
you beat me - and you gave him the answer - I was going to make him work a bit for it ....
'g'
|
|
|
|
|
not sure what the issue is - you're most of the way there.
Assuming you define MAX_WIDTH to be 10, you could look at replacing the
cout << setw(4) << grades[i] << endl;
with something like :-
cout << setw(4) << grades[i];
then you need to check if i is an even multiple of MAX_WIDTH, and print
cout << endl;
if that is true, inside the for loop of course - hint, look at the '%' operator for the modulus function
That should be enough - see what you can do ..
'g'
|
|
|
|
|
Garth, this for the suggestion. I was wondering if you had an e-mail or AOL instant messenger, or ever facebook I could contact you through.
|
|
|
|
|
Hi,
I have a newbie question I hope somebody can help me with.
I am writing a custom stl container, basically a specialized kind of tree. The container needs to implement a variety of iterator options (preorder traversal, postorder traversal, breadth-first traversal, depth-first traversal, etc). The easiest way to do this appears to be to write a number of distinct iterators that traverse the tree in different ways.
I see from the standard stl containers that they always typedef "iterator" and "const_iterator" (plus reverse versions). Since I will have more than one kind of iterator, I am not sure how my container can be made stl compliant.
So my question is, is it a strict requirement of an stl container that it exposes these standard iterator typdefs? If I typedef "iterator1", "iterator2", etc., will the stl algorithms still work without any unforeseen problems, or are there specific requirements for the presence of "iterator" and "const_iterator"?
I hope this makes sense, please let me know if further clarification is needed.
Thanks for any advice and help! I really appreciate it.
Mellib
|
|
|
|
|
What's your preferred choice of tool for automating your C++/MFC projects? Nant/Vcbuild etc?
We currently dont do automated daily builds: something we're intending to start.
Looking for ideas and suggestions.
thanks!
|
|
|
|
|
CruiseControl.NET (cc.net) is nice (and cheap)
|
|
|
|
|
Before I say anything, I've done a lot of searches, and haven't had any luck yet. Also, I'm a beginner, so most like I'm not using the correct terms to describe what I want, so please excuse me. Thank you in Advance
Lets say you have two monitors. You are using firefox and you want to just drag the firefox screen to the second monitor. Now instead of two monitors, you have two users remotely logged in to the same computer. User A wants to give you user B program 1 in its exact state. How do you do this?
This is what I am doing now:
Person A remotely log in as user A, and starts program 1. Person A ran into a problem with program 1 and requests help from person B. Person A logs off, so person B can remotely log on to user A, where person B can debug program 1 in the exact state where person A had it.
This is what I want to do:
Person A logs in as user A, and starts program 1. Person A ran into a problem with program 1 and requests help from person B. Person A sends the UI Window to person B who is remotely logged on as user B on the same computer.
I don't know if this is even possible or if it makes sense.
|
|
|
|
|
Have you considered using VNC? I havent tried this exact scenario on the same PC but it might work. PersonA can tell PersonB he has a problem, and PersonB connects to PersonA's console?
|
|
|
|
|
No that is not exactly what I want. Person A still has to log off for person B to log on. I guess what I'm doing is not possible, but then again no one on this forum told me its impossible either. The answer I wanted most right now is, either its possible, or not.
|
|
|
|
|
Hello friends,
I want to develope a software which can run for standard users.
My software will be installed for only for current user.
My superior wants me to keep read only files(Exe ,Dlls...) in Program files path.
Other data files in Appdata path,Since those files required Read & write access.
Ex:
Lets consider two user accounts in a PC.
1) administrator
2) joe ( standard user)
Now the user logged in as a joe and trying to install the software.
So my setup file asks for elevation becoz it has to put files in program files path.
Once the installer has got elevated ,after that if i am getting Environment variable "AppData" to put the data files.
It gives me "C:\users\administrator\Appdata\Roaming\" path, but actually i have to put the files for user joe.
I dont know how to get the currently logged in users Profile directory.
Note:
After the elevation . if I am getting the HKCU profile that also gives me the administrator profile only.
Try outs:
I was loggin as a Joe ( standard user)and launching the setup file.Setup file asks for elevation.
From My setup file(runs in administrator account after elevation), I tried to find "expolrer.exe" (runs in Joe account) and getting it is ProcessToken and CreateEnvironmentBlock fn to create environment block for the Explorer.exe.
In Vista it is succeeding but in XP OpenProcess fails if i am elevating the exe and trying to get info from the Explorer.exe which runs in Joe's account.
HANDLE hProcessHandle = OpenProcess(PROCESS_QUERY_INFORMATION,FALSE,dwExploererProcessId);
if( hProcessHandle == NULL)
return -2;
int nRetVal = OpenProcessToken(hProcessHandle,TOKEN_QUERY,&hToken);
if(nRetVal == 0 )
return -3;
BOOL bval = CreateEnvironmentBlock(&lpData,hToken,FALSE);
if(bval == FALSE)
return -4;
Advice me about the correct way to get the Currently logged in users profile directory.
Eagerly waiting for your answers.
Thanks ,
WindowsPistha
|
|
|
|
|
WindowsPistha wrote: Advice me about the correct way to get the Currently logged in users profile directory.
Maybe use SHGetFolderPath(), or on Vista+ only, SHGetKnownFolderPath().
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Both i tried SHGetFolderPath(), or on Vista+ only, SHGetKnownFolderPath().
Both gives administrator profile directory only, if elevated.
modified on Thursday, October 30, 2008 2:42 PM
|
|
|
|
|
WindowsPistha wrote: Both gives administrator profile directory only, if elevated.
What did you use as the fourth argument (i.e., dwFlags ) to SHGetFolderPath() ?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
I used SHGFP_TYPE_CURRENT flag that also gives me the elvated users app data path.
modified on Friday, October 31, 2008 6:36 AM
|
|
|
|
|
Have you tried SHGFP_TYPE_DEFAULT to see if it yields anything different?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
|
Thanks !
I have red the link.
SHGetKnownFolderPath also gives me the admin users appdata path.
Not the currently windows logged in users appdata path.
|
|
|
|
|
Hi, my problem is I want to add an array containing some null bytes at the beginning of it, to a std::string like this:
std::string MyString = "\x00\x00\x01\x02";// "It won't copy anything into MyString but...
std::string MyString2 = "\x01\x00\x03"; // Will copy the array includiing the null byte and whats after it.
What should I do? Thanks
|
|
|
|
|
I think Ill reply to myself:
There is a constructor for what I want and it is:
string ( const char * s, size_t n );
Anyway, do you think it can give me some kind of problem using std::strings for byte array handling? Thanks
|
|
|
|
|
santiageitorx wrote: do you think it can give me some kind of problem using std::strings for byte array handling?
The class is named string , what do you think?
You might want to pick up a copy of Kent Becks book, Implementation Patterns.
led mike
|
|
|
|