|
Oh. Really Thanks.
Nice talking to you. If you judge people, you have no time to love them. -- Mother Teresa
|
|
|
|
|
Is the static member variable in class will same for all objects of that class?
Nice talking to you. If you judge people, you have no time to love them. -- Mother Teresa
|
|
|
|
|
yes static member variables are same for all objects of the class. As the scope of static member variable is class level not of object level. Each object of the class can access and share static member of class.
Static member is accessed via class name and not by object name, like
//static member accessment
className.staticmember = someValue
//object level variable.
objName.objMember
-shoaib-
|
|
|
|
|
hello,
I have declared a classe, when i creat instance of this classe, it work but when I call a thread it does not work
Thread ^trd;
ThreadStart ^myThreadDelegate = gcnew ThreadStart(this, &BHIDS00::Form1::rep);
trd = gcnew Thread(myThreadDelegate);
trd->IsBackground = true;
trd->Start();
avec rep() { .....................} est une méthode que je veux appelé
or in this methode there are listView->items->add(".."); with thread it doesn't display in listview, and I do rep();
how i do work my methode using thread ???
Merci beaucoup
|
|
|
|
|
|
Cool! I have't used forms yet, but I filed that away for future reference.
Thanks!
Mark
Mark Salsbery
Microsoft MVP - Visual C++
"Great job team! Head back to base for debriefing and cocktails."
|
|
|
|
|
When you see System::String used with “xxx” in some text or example you almost always see the ‘L’ macro in from of the text (L”xxx”). However if I do not use the ‘L’, It seems to have no affect to my String values. Am I missing something?
String ^MyText = "Blah";
String ^MyOtherText = L"Blah";
Same right?
Programmer
Glenn Earl Graham
Austin, TX
|
|
|
|
|
I don't agree with my own reply
I think the compiler now automatically uses the appropriate type when it knows the context.
String ^MyText = "Blah";
The literal "Blah" ends up in the assembly metadata as a CString^, just as using the 'S'
prefix did in VS2003.
hmm - maybe I need to look in the MSIL to see if there's a difference
Mark
-- modified at 15:55 Monday 16th July, 2007
Mark Salsbery
Microsoft MVP - Visual C++
"Great job team! Head back to base for debriefing and cocktails."
|
|
|
|
|
Its the same MSIL whether you use L or not.
|
|
|
|
|
Cool! Thanks for saving me the time
Cheers!
Mark
Mark Salsbery
Microsoft MVP - Visual C++
"Great job team! Head back to base for debriefing and cocktails."
|
|
|
|
|
Mark Salsbery wrote: String ^MyText = "Blah"
Hi, What this "^" cap symbol represents? where it is useful?
Nice talking to you. If you judge people, you have no time to love them. -- Mother Teresa
|
|
|
|
|
Its a handle. Used like a pointer for pointing to managed objects on the managed heap. Its pretty fundamental to writing managed code with C++/CLI.
|
|
|
|
|
Hello,
I have never programmed before and I am trying to teach myself C during downtimes at work. The first program that I did is the Hello World program. I am using the Compiler Dev C++ and when I run the program it closes immediately and I don't the chance to see it. Can Anyone help me. This is what I have for code:
#include <iostream>
using namespace std;
int main (void)
{
cout << "Hello World!";
return 0;
}
Steve Vondras
Red Lake Nation
MIS Tech
svondras@redlakenation.org
|
|
|
|
|
I am going to go out on a limb here and say that you mean that a console window displays then immediately closes. I believe that you need a getch() before the return.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
|
|
|
|
|
Thanks for the quick reply, it worked right away. I have seen the code for this hello world in several different places, but I have never seen the getch(). Why is that?
Steve Vondras
Red Lake Nation
MIS Tech
svondras@redlakenation.org
|
|
|
|
|
The code as you wrote in your original message did a cout and then returned. It did that. Returning meaning that the program was finished so that the window closed. Getch() simply waits for keyboard input before the program continues.
If you were to run your program from a command prompt, you would not need the getch().
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
|
|
|
|
|
Like Wes said, it closes right after running if it is a console app. If you run it from a Dos box, it'll stay there with the Dos prompt when done.
Good luck on learning C++. Dev C++ is nice, have you looked at the Express Editions of C++/C#?
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
If you mean Visual Express, yes I have. I am thinking of getting a version of it if the price is right. Thanks for the response.
Steve Vondras
Red Lake Nation
MIS Tech
svondras@redlakenation.org
|
|
|
|
|
Red Lake wrote: I am thinking of getting a version of it if the price is right.
You should. I think it is still FREE
There was a way to get Visual Studio Standard Edition for "free" ( just pay the shipping and handling ) from Microsoft by watching two of their labcasts. I think it expired at the end of June. I'd keep an eye out for that.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|
I need some help...
I have a dialog based app and I want to register the (window) class. So many question have I.
1) where do I put my code for registering the class?
2) do I use RegisterClass, RegisterClassEX, AfxRegisterClass, AfxRegisterClassEx?
3) REASON: interprocess communication using Windows Messaging
I have some legacy code that i'm looking at for an example, but it is a Doc-View type and it appears easier as it has the registeration inside the PreCreateWindow( ) function - see below
Thanks,
Johnny
<br />
#define MYAPPWINDOW_CLASSNAME _T("MyOwnWindow") //window class name<br />
<br />
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)<br />
<br />
WNDCLASS wndcls;<br />
HINSTANCE hInst = AfxGetInstanceHandle();<br />
<br />
if( !(::GetClassInfo(hInst, MYAPPWINDOW_CLASSNAME, &wndcls)) )<br />
{<br />
if( ::GetClassInfo( hInst, cs.lpszClass, &wndcls ))<br />
{<br />
wndcls.lpszClassName = MYAPPWINDOW_CLASSNAME;<br />
wndcls.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDR_MAINFRAME));<br />
if( !AfxRegisterClass(&wndcls) )<br />
{<br />
AfxThrowResourceException();<br />
return FALSE;<br />
}<br />
}<br />
else<br />
{<br />
AfxThrowResourceException();<br />
return FALSE;<br />
}<br />
}<br />
<br />
cs.lpszClass = MYAPPWINDOW_CLASSNAME;<br />
|
|
|
|
|
As a general rule, use the Afx functions in an MFC app and use the API functions in a Win32 app.
You can put the call anywhere as long as it gets called before attempting to create a window of
the registered class. PreCreateWindow() is fine.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
"Great job team! Head back to base for debriefing and cocktails."
|
|
|
|
|
I am still lost and now frustrated (with MSDN documentation on the matter.)
What I have is a dialog based app and inside my OnInitDialog(), I have put what is the beginnings of registering my window class..
When I do this, i get the runtime "warning" that "A required resource was unavailable." (i trace this to the second call to ::GetClassInfo() as I don't know how to properly supply the 2nd parameter.)
<code>BOOL CMyDlg::OnInitDialog()
{
CDialog::OnInitDialog();
WNDCLASS wndcls;
HINSTANCE hInst = AfxGetInstanceHandle();
if( !(::GetClassInfo(hInst, MYOWNAPP_CLASSNAME, &wndcls)) )
{
if( ::GetClassInfo( hInst, NULL, &wndcls ))
{
wndcls.lpszClassName = MYOWNAPP_CLASSNAME;
if( !AfxRegisterClass(&wndcls) )
{
AfxThrowResourceException();
return FALSE;
}
}
else
{
AfxThrowResourceException();
return FALSE;
}
}
return TRUE;
}
</code>
|
|
|
|
|
I don't think you need the second call. Even if you did, using NULL as the second param isn't
documented.
If the first call fails, go ahead and register the class.
Actually, you can just call AfxRegisterClass(). MFC will check if it's already registered
Mark
Mark Salsbery
Microsoft MVP - Visual C++
"Great job team! Head back to base for debriefing and cocktails."
|
|
|
|
|
Hi, I'm using Visual Studio 2005 C++/CLI. I have a file with the following format:
DEVICE : TK65603
WAFER : 08
LOT : 006X
52 NULL 20 NULL 31 NULL <carriage return="">
52 NULL 18 NULL 26 NULL <carriage return="">...for 1000 records.
I am trying to set up a FileStream to read the data from this file for processing.
FileStream^ fileStream = gcnew FileStream(strFilePath, FileMode::Open);
StreamReader^ streamReader = gcnew StreamReader(fileStream);
The following reads the first threee lines just fine.
strDeviceName = streamReader->ReadLine();
strWaferNumber = streamReader->ReadLine();
strLotNumber = streamReader->ReadLine();
But then if I try to read the next line the command terminates at the NULL character and all I have in my variable is the first of the three fields (52). I have tried some variations of BiaryReader also. What approach would anyone recommend to work around this issue?
Buck
|
|
|
|
|
Are you still having trouble with this?
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|