|
when I try calling it from outside the constructor, it won't close. What I'm going to try doing is A), create the window in a new background thread and have the foreground thread close it in 3 seconds or B)have the constructor of the new form take a variable.... incomplete thought as of now, will try A) 1st =)
------
The background worker thread method worked
__gc class heh: public Form
{
public:
heh()
{
Size = System::Drawing::Size(300,300);
Text = "I Should be gone soon";
}
};
__gc class test: public Form
{
heh* mm;
void popup(){ mm->ShowDialog(); }
public:
test()
{
Text = "Base Form";
mm = new heh();
Thread* worker = new Thread(new ThreadStart(this, &test::popup));
worker->IsBackground = true;
worker->Start();
Thread::Sleep(100);
mm->Close();
worker->Abort();
}
};
--------------------------
One problem with the programmer's mentality is insecurity. This goes deep. An insulting college litany says that failed mathematicians become computer programmers. They are also ridiculed for being nerdy losers, for being too fat or too skinny, and for having few social skills. Most programmers can be spotted easily in a crowd. Nobody really wants to hang out with them. Put thousands of these people in one company and if you can get them to work, you become a billiona
|
|
|
|
|
hi, I have a textbox on a form that gets updated by the users, it's sort of
like a log of events. The problem I'm having is, I don't know how to add a
newline.
I'm VB.NET, I got it to work by doing
txtLog.AppendText(Format(TimeOfDay, "hh:mm ") & stgEventName &
txtMessage.Text & vbNewLine)
which concated the current time, the event name, the event message with a
visualbasic_newline
and it would look like:
14:34 POP3 email received
18:24 FTP received connection request from IP 24.29.165.87
18:38 FTP received connection request from IP 24.29.165.87
18:28 FTP received connection request from IP 24.29.165.87
but in Managed C++, it's coming out like
14:34 POP3 email received 18:24 FTP received connection request from IP
24.29.165.87 18:38 FTP received connection request from IP 24.29.165.87
18:28 FTP received connection request from IP 24.29.165.87
I tried doing:
String* message = IncomingEvent;
message->Concat(message, "\r\n");
ChatBox->AppendText(message);
but to no avail =(
--------------------------
One problem with the programmer's mentality is insecurity. This goes deep. An insulting college litany says that failed mathematicians become computer programmers. They are also ridiculed for being nerdy losers, for being too fat or too skinny, and for having few social skills. Most programmers can be spotted easily in a crowd. Nobody really wants to hang out with them. Put thousands of these people in one company and if you can get them to work, you become a billiona
|
|
|
|
|
Hi folks,
Just joined up with this site and I must say... very nice!
Anyway... I created a bunch of classes in VB6 for working with playfields/sprites using a lot of GDI functions. Unfortunately my COM skills were a bit young and with the difficulties and lack of info for GDI it ended up a bit buggy. Now I want to convert the whole thing into VB.NET with GDI+, however I'm having a bit of trouble with the Graphics object. It seems that u can only get access to the Graphics objects from within the OnPaint event, whereas I really want to be working on it in a seperate thread.
If someone could help me out with a simple VB.NET example with a picture moving or animating on a form it would be greatly appreciated.
Otherwise I u think u might be able to help me but wanna know more details, just ask.
Thanx in advance...
cya,
Kermitt
|
|
|
|
|
Welcom to codeproject.
This site is mostly refer to VC++,so it's not easy to find it here,but you can see .Net and VB part in CP,maybe it can help you.(there are some articles about GDI+ but they are in VC)
http://www.codeproject.com/dotnet/
Mazy
Don't Marry a Person You Can Live With...
Marry Someone You Can Not Live Without
|
|
|
|
|
Thanx for the reply Mazdak.
I should've mentioned that I have seen those other GDI+ articles. They're what drew me to the site in the first place. My experience of C mainly consists of converting small bit of code to VB (a lot of that trying to figure out the GDI API functions) so those articles are just a little too much for me. Although I don't think they would solve my problem anyway because they all seem to create the Graphics object by using a hdc. When using any form of managed code ontop of dotnet, there is simply no such thing as a hdc (that I've found) so those examples kinda sidestep the problem I'm stuck on.
cya,
Kermitt
|
|
|
|
|
The Control class has a method CreateGraphics() which will return a graphics object for drawing on to the control.
Nearly all of the Windows Forms classes inherit from Control, including the Form class; so you can call CreateGraphics() at anytime.
Important when you are done with the Graphics object returned by CreateGraphics() you must call Dispose() on the object.
Public Sub DrawStuff()
Dim g as Graphics
g = myFormInstance.CreateGraphics()
' Draw on g
g.Dispose()
End Sub
HTH,
James
Sonork ID: 100.11138 - Hasaki
"My words but a whisper -- your deafness a SHOUT.
I may make you feel but I can't make you think." - Thick as a Brick, Jethro Tull 1972
|
|
|
|
|
Does anybody know if the old projects can be compiled fine under VS.NET?
|
|
|
|
|
Visual C++ compile just fine on two of the projects I've tried (it's a Win32 application using DirectX, and an MFC application)
Andres Manggini.
Buenos Aires - Argentina.
|
|
|
|
|
VS.Net messed up one of my projects. It was a library with a dozen build permutations (MFC, non-MFC, MFC DLL, Unicode, ...) and several test programs, most of which dealt with only a subset of the permutations. The VS.Net project ignored all the dependencies I had set and insisted on building some sort of every project for every permutation of the base library.
Having said that, the permutations that were "aligned" build fine (except for some code derived from CString which broke--I kept VS.Net on my machine long enough to fix that code (just because) and then uninstalled it.)
|
|
|
|
|
Having downloaded all the disks, and burnt them from subscriber downlods I've tried installing it on two machines an it failed about an hour and a half in.
The error code is MSI error 2337, which according to the MSDN Lib, is due to a badly authored script - internal error.
From the error log :
[02/12/02,17:06:20] vs70uimgr: DisplayMessage: Internal Error 2337.
[02/12/02,17:06:20] Visual Studio .NET Enterprise Architect - English: ***ERRORLOG EVENT*** : ERROR: Internal Error 2337.
[02/12/02,17:06:20] Visual Studio .NET Enterprise Architect - English: ***ERRORLOG EVENT*** : ACTION FAILURE: Action ended 17:06:20: InstallFinalize. Return value 3. See MSI log for details.
[02/12/02,17:12:52] Visual Studio .NET Enterprise Architect - English: ***ERRORLOG EVENT*** : ERROR processed; exception was thrown for retail build
Developer Comment: Action Start message out of order
Build Time: Thu Feb 15 17:56:18 2001
File: f:\vs70builds\9466\vs\src\vssetup\setupexe\sitmanagers\brooklyn10\cmsiprogesshandlervs.cpp
Line Number: 230
Expression: (0 > iDiff)
HRESULT: -2147467259
[02/12/02,17:13:25] Visual Studio .NET Enterprise Architect - English: ***ERRORLOG EVENT*** : ACTION FAILURE: Action ended 17:13:25: INSTALL. Return value 3. See MSI log for details.
[02/12/02,17:13:33] Visual Studio .NET Enterprise Architect - English: MsiInstallProduct return code: 1603.
I just noticed that the file to be accessed should be on the CD drive which is E:, not F, which is a Netword drive, and this folder structure does not exist. Yet, the other PC (Athlon) installed from CD (D) there is no F drive.
On PC in an Athlon 1Ghz, 700MB, Win2K SP2 with IE6, and the other is a P3 700Mhz, 256MB, NT4 SP6, IE6.
I have redownloaded the disk in question and reburt is, yet I get the same error.
Any ideas?
Thank,
Giles
|
|
|
|
|
How do you make managed c++ programs run on other computers that don't have Visual Studio.NET installed. I installed dotnetfx.exe on a win2k and winme machine and ran a managed c++ program that creates a form but it doesn't work.
--------------------------
One problem with the programmer's mentality is insecurity. This goes deep. An insulting college litany says that failed mathematicians become computer programmers. They are also ridiculed for being nerdy losers, for being too fat or too skinny, and for having few social skills. Most programmers can be spotted easily in a crowd. Nobody really wants to hang out with them. Put thousands of these people in one company and if you can get them to work, you become a billiona
|
|
|
|
|
You shuold install .Net platform on that machine
Mazy
Don't Marry a Person You Can Live With...
Marry Someone You Can Not Live Without
|
|
|
|
|
Why Microsoft introduced this new "attributes" in its .NET programming? Can someone throw some useful information (links to definitions) on this attributed programming?
Wondering what would be the advantage of having them as attributes and not properties inside a class (which needs these attributes to be setup)....?
omkamal
|
|
|
|
|
omkamal wrote:
Why Microsoft introduced this new "attributes" in its .NET programming?
It's another proprietary extension to tie people into MS's compiler, and hides the details of writing COM classes from people who think it's too hard to do.
--Mike--
"Everyone has figured out what 'service pack' really means, so they had to go and change the language. Perhaps this is what Bill was talking about in the 'security is top priority' letter."
-- Daniel Ferguson, 1/31/2002
My really out-of-date homepage
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
Attributes allow you to decorate code with various properties at compile time.
Then at runtime those properties can be examined and the data extracted. I'm thinking about writing an article for CP about this topic, I just need to come up with a different use for attributes so it doesn't clash with my commercial product
An attribute can be nothing more than a flag, SerializableAttribute , or it can perform something useful, ToolboxBitmapAttribute .
I suppose, you could think of an attribute as a readonly property on a type.
VS.NET uses attributes internally, if you design a usercontrol numerous attributes can be applied to the class and its properties to effect the visual and usage outcome. You can specify the toolbox bitmap, which properties show up in the properties box, whether those properties are readonly, and if it has an UI Editor.
From what I've read COM doesn't let you specify many attributes, where .NET allows you to place an attribute on anything (even attributes have an attribute, AttributeUsage which specifies where it is valid to use an attribute)
James
Sonork ID: 100.11138 - Hasaki
"My words but a whisper -- your deafness a SHOUT.
I may make you feel but I can't make you think." - Thick as a Brick, Jethro Tull 1972
|
|
|
|
|
James T. Johnson wrote:
I'm thinking about writing an article for CP about this topic,
And I would be your first reader.
I also read some of the msdn articles about this attributed programming. The key definition they give is...
Attributes, a new feature in Visual C++, are designed to simplify COM programming and .NET Framework common language runtime development. When you include attributes in your source files, the compiler works with provider dynamic-link libraries (DLL) to insert code or modify the code in the generated object files.
Unfortunately, I just got only a few information about attributes. But I am now wondering how I can apply attributes in my programming? What are the advantages of using attributes over properties... And finally how to create and use a owner-defined attributee???
Will your article cover these..........(Oh! please tell me yes)
omkamal
|
|
|
|
|
omkamal wrote:
What are the advantages of using attributes over properties
I don't like saying one technique is better than another; its really just personal preference, but I hope when I'm done you'll find where using attributes makes sense and where a static property makes sense
omkamal wrote:
Will your article cover these..........(Oh! please tell me yes)
Right now I'm thinking of covering "Using existing attributes" and "Creating and using your own attributes", plus any glue that seems neccessary to blend the two topics. Plus I plan on including an example of writing and using your own attributes.
James
Sonork ID: 100.11138 - Hasaki
"My words but a whisper -- your deafness a SHOUT.
I may make you feel but I can't make you think." - Thick as a Brick, Jethro Tull 1972
|
|
|
|
|
In .NET VC when viewing "Class View" one can click on a class in the tree and then click the lightning bolt (events), the dialog (messages) or the rhombus thingy (overrides) to create message maps and such. My question is, mine doesn't work anymore in my project. How do I get it to work again? This is just like the crap in VC.6 when the class view would get screwed up their. I hate this crap. Someone tell me what file to delete or modify to get it working again.
Thank you!
|
|
|
|
|
Since I didnt have enough space in my disk, I did not install the documentation for VS.NET release version. But when I tried to convert one of my older c# application which uses the System.Windows namespace, to VS.NET final version, it is throwing a compilation error for "Windows is not found in the system namespace".
Did they move it? Or did they remove it?
omkamal
|
|
|
|
|
I am not sure what was in System.Windows but the only ones I have that sound alike are System.Win32, System.Windows.Forms and System.Windows.Forms.Design.
|
|
|
|
|
Never mind. I got it. My project was not referencing to the required dlls. So dont worry they are all there.
omkamal
|
|
|
|
|
I realize this question has probably been asked and anwered already, but I'm am now ready to move from 6.0 to .NET. I want to continue with MFC and to ease myself into the .NET framework gradually. However, I am just curioes as to how much MFC has changed under .NET. Have they added a lot to it? Does moving into that environment buy that much for you? Or is it just as well to develope MFC apps with 6.0? In other words, is it just the same old MFC with a new wrapper?
"Thank you, thank you very much" Elvis.
|
|
|
|
|
MFC has new classes, CString is templatized.
New stuff in ATL.
Faster Compiler.
Better IDE - excepted for touching up resource images.
Real easy to import VC6.0 projects.
Around thumbs up.
Normski. - Professional Windows Programmer
|
|
|
|
|
Thanks. How about XML support in the new MFC? Is that there? I've been hacking around with some DOM and SAX2 stuff and basically thinking it sucks. Has that improved?
I'm trying to find some documentation but can't seem find so much as a class heirarchy chart.
"Thank you, thank you very much" Elvis.
|
|
|
|
|
Stan Shannon wrote:
Thanks. How about XML support in the new MFC? Is that there? I've been hacking around with some DOM and SAX2 stuff and basically thinking it sucks. Has that improved?
Yeah I know what you mean. AFAIK the only XML support is thru the .NET framework, which mean you have to branch into some managed code.
Normski. - Professional Windows Programmer
|
|
|
|