|
Thank you. Now it is working. I have interchanged LPARAM and WPARAM parameters. Here is my code.
DWORD GetComboBoxIndex = 0;
GetComboBoxIndex = SendMessage(hWnd, CB_FINDSTRINGEXACT, -1, (LPARAM)str);
SendMessage(hWnd, CB_SETCURSEL, GetComboBoxIndex, NULL);
Regards
msr
|
|
|
|
|
You are welcome.
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 have the code about create many modeless dialog .
for(int i=0;i < 5;++i)
{
pRegionDlg[i] = new CRegionDlg ( this );
pRegionDlg[i]->Create( IDD_DIALOG , this );
pRegionDlg[i]->ShowWindow( SW_SHOW ) ;
}
this code is error heap . but I don't understand why it's error . while this code can run good on other program .
Thanks for reading and helping .
|
|
|
|
|
HTT90 wrote: this code is error heap . but I don't understand why it's error . while this code can run good on other program .
What is this supposed to mean? What error? Where? How was pRegionDlg declared? Please clarify.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Maybe 'the other program' properly allocates the pRegionDlg array.
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 did :
in header file :
CRegionDlg *pRegionDlg[8] ;
and when I debug , I receive a message , it's inform me no loaded from dll . and heap is error .
|
|
|
|
|
Please don't define arrays in header files.
Please report full error message.
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 don't know why now it's run good and no error . .
Can You say why don't define arrays in header files ?
I'm chicken .
|
|
|
|
|
You should never define variables inside header files (headers are for declarations), because you may get multiple definitions of the same symbol (if, as usual, the header is included by many sources).
If you need to access a variable from multiple sources then you have to:
- Declare it as
extern inside an header file. - Define it inside just one source file.
- Include the header file into every source that needs to access the variable itself.
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]
|
|
|
|
|
Thanks . .
|
|
|
|
|
Hey,
Iam reading this book and Iam writing my own program aside.
Iam currently reading about some functions related to linux.
#include <stdio.h>
#include <iostream>
using namespace std;
int main(int argc,char *env[])
{
int i=0;
cout << env[i] << endl;
return 0;
}
This is the program, now how would I actually put the output of env[i] into a string?
In my own program Iam playing around with conversions and string editing and stuff, now I need to convert the output of env[i] into a string though, not sure how to do that.
Thankfull for any help, greetins
|
|
|
|
|
ALLERSLIT wrote: int main(int argc,char *env[])
This should probably be:
int main( int argc, char *argv[], char *env[] )
ALLERSLIT wrote: how would I actually put the output of env[i] into a string?
Have you tried:
std::string str = env[i];
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Oh thanks, gotcha!
let's say I wouldn't put
char *env[] there into the main() thingy, how would I be able to get the output of env[i] then?
Like
#include <stdio.h>
#include <iostream>
#include <string>
using namespace std;
int main()
{
char *env[];
string str = env[9];
cout << str << endl;
return 0;
}
I get this error: |14|error: storage size of ‘env’ isn't known
Makes sense to me, but how would I avoid that error?
|
|
|
|
|
ALLERSLIT wrote: Makes sense to me, but how would I avoid that error?
By declaring env as:
char *env[10];
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
If I declare it the way you did, I can not put it into a string the same way i learned in the last post.
|
|
|
|
|
You seem to be misunderstanding main() 's signature and it's various formats. That said, what exactly is it that you are trying/wanting to do?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Trying to figure out how to get the outpuf of env[i] without putting all that other stuff into main()'s signature.
|
|
|
|
|
Whether you declare them in the signature or not, the number of command-line arguments, the command-line arguments themselves, and the environment variables are "sent" to main() regardless. Obviously, if you opt to not declare them in main() 's signature, you will not have access to them.
That said, what is env and how is it declared?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
You may access the _environ variable.
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]
|
|
|
|
|
That makes no sense to me, even if you fix the error the way David (correctly) suggested (the array content is still uninitialised).
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]
|
|
|
|
|
ALLERSLIT wrote: how would I avoid that error?
By declaring env properly according to the rules thus:
int main(int argc, char* argv[], char *env[])
{
}
Your sample above declares env as a local variable that is never initialised so you cannot get anything out of it. Remember that main() is simply a function that is called by the framework with the three parameters as I have described.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
I have made a .net application which uses a COM component hosted by a C++ service. The service is a simple C++ service developed using ATL (and not using MFC).
Everything works fine on my dev machine as most of the work is done by VisualStudio itself.
Now I have to make installer of my application (application should be able to get install on XP, VISTA and Windows 7). I am following below steps to register my service:
"C:\Program Files\MyApplication\MyService.exe" -service (For registering the service)
"C:\Program Files\MyApplication\MyService.exe" -Embedding (For registering the COM component hosted by service)
And to unregister my service and COM component hosted by it I am following below step:
"C:\Program Files\MyApplication\MyService.exe" -UnregServer
Q: Please let me know if steps to register and unregister the service and COM component it hosts, are correct or I am doing something wrong. Or I am missing something.
I don't have VISTA and Windows 7 on my machine and have not ever worked on them. So its important to confirm before I release my application.
Thanks in Advance
Regards
Aseem
|
|
|
|
|
Good day.
Is there an "efficient" way to check if a resource ID used in the code is effectively defined in the resource file ?
For example if a function is declared but not defined, the linker will report an error if the function is called.
I'd like to be able to report that if I do something like that :
#define IDS_MY_STRING 1234;
CString s;
s.LoadString(IDS_MY_STRING);
and IDS_MY_STRING is not in the RC file.
The compiler and/or the linker and/or the resource compiler will warn me about that.
Thanks.
Max.
Watched code never compiles.
|
|
|
|
|
You could use the "source browser" to check all references to IDS_MY_STRING .
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
As far as I know, it doesn't exists a way to do automatically what you are asking for.
What you can do in Visual Studio is: go to the Resource view of your project (you can use the shortcut Ctrl+Shift+E), then right-click on the root node of your resources (e.g. on myproject.rc) and choose the option Resource Symbols....
What you get is a list of all the identifiers defined inside the resource.h file, each one with its numeric value and a flag indicatin whether there exists or not a resource inside the .rc file that uses it. In the textbox named Used by: you have informations about which kind of resources exists that use the selected identifier.
|
|
|
|