|
I agree with the feed back. The code would benift with a rewrite. The game is finished now but the next program I will try to pay more attention while coding. Thanks for the help.
|
|
|
|
|
Thanks for the suggestions. The "o1 = NULL;" didn't work but I found a work around.
|
|
|
|
|
i wrote a dll with an external function:
__declspec(dllexport) HWND _stdcall StartWindow(char *WindowTitle, char *WindowText, int Style)
{
System::String ^ TextString = gcnew System::String(WindowText);
System::String ^ TitleString = gcnew System::String(WindowTitle);
Application::EnableVisualStyles();
ProgressBarWindow ^form = gcnew ProgressBarWindow();
form->textBox1->Text = TextString;
form->Text = TitleString;
if (Style == 1){
form->progressBar1->Style = System::Windows::Forms::ProgressBarStyle::Marquee;
}
else if (Style == 2){
form->progressBar1->Style = System::Windows::Forms::ProgressBarStyle::Continuous;
}
form->Show();
HWND WindowHndl = (HWND)form->Handle.ToPointer();
HWND textboxHandle = (HWND)form->textBox1->Handle.ToPointer();
return WindowHndl;
}
it returns the WindowHandle but i need to return the textboxHandle too!
how can i do that?
|
|
|
|
|
You cannot return more than one item. Get the caller to send you the a pointer (to a HWND) where you can store the handle; something like:
HWND hTextBox;
HWND hWnd = StartWindow("Title", "Text", WM_STYLES, &hTextBox);
and then your function would do
__declspec(dllexport) HWND _stdcall StartWindow(char *WindowTitle, char *WindowText, int Style, HWND* pHwnd)
{
*pHwnd = textboxHandle;
I must get a clever new signature for 2011.
|
|
|
|
|
I create a Window with a ProgressBar (Marquee Style) but it doesnt work, id doesnt show anything!
here is my code:
ProgressBarWindow ^form = gcnew ProgressBarWindow();
form->textBox1->Text = TextString;
form->Text = TitleString;
form->progressBar1->Style = System::Windows::Forms::ProgressBarStyle::Marquee;
form->Show();
The textbox and the title are filled correctly in the form!
modified on Wednesday, March 16, 2011 8:37 AM
|
|
|
|
|
there must be a lot more code related to the PrograssBar. It needs some properties set including Size and Location (or Bounds), it needs to be added to the Form's Controls property, etc. You didn't show these (if added through Visual Designer, they would be in a separate file, where textBox1 initialization would be too), so I can't tell what is wrong.
FWIW: MSDN on ProgressBar holds a remark "The Marquee style is honored only when visual styles are enabled. The Continuous style is honored when visual styles are not enabled." So check your app's Main() method.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
i forgot "Application::EnableVisualStyles();" in my main....
thx for your help 
|
|
|
|
|
I am writing a code in visual studio 2008 c++.I have to use linear feedback shift register,so i have downloaded the library from
http://lfsr-generator.sourceforge.net.
On the web procedure is mentioned for installing it, that contains some commands like given below.
$ ./configure
$ make
# make install
I have written these command in cmd,but i didn't works there.Please tell me how I can install it,or how i can use this library in my code.
Thanks in advance
Ishtiaq
|
|
|
|
|
I think you may find that this project has been designed for UNIX only. You will probably need something like cygwin[^] to run it on a Windows system.
I must get a clever new signature for 2011.
|
|
|
|
|
Thanks for the reply. I think cygwin would be the right option for me. Could you please tell me how to use cygwin? Or if you know of any online material that would help me get going on using it.
Thanks.
|
|
|
|
|
smishtiaqhussain wrote: Could you please tell me how to use cygwin? Or if you know of any online material that would help me get going on using it.
I gave you the link to the cygwin site in my previous answer, now it's up to you to go and learn about it.
I must get a clever new signature for 2011.
|
|
|
|
|
why would you go and suffer all the trouble, when a shift register just takes a few lines of code anyway? write a little class that does what you need and add it to your current project. No third party stuff, no separate project, no hassle. Or am I missing something here?
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Luc Pattyn wrote: why would you go and suffer all the trouble, when a shift register just takes a few lines of code anyway?
Because it isn't just a register shift.
|
|
|
|
|
Hi all.
I have a strange problem. I have tryed local .NET forums and MSDN with no luck but I have faith in you guys
Anyway, her's the situation:
We have a Win32 application written in Clarion for Windows. This dev tool produces standard Win32 binary similar to C++. The Clarion Compiler is actually a C++ compiler as well as compiling Clarion code so the result is the same
We allso have a large .NET library we want to utilize in this Clarion software. But since Clarion is not .NET compatible or is able to compile managed code, I had to figure out what to do. The answer was quiet simple actually. C++/CLI was what I was looking for. I then created a small C++ DLL that wrapped my .NET library. This works perfectly and everyone is smiling......until we installed the software on our Windows 2003 Terminal server..... DANG!! Error 0XC0000005!! The Error shows at loading time, before any code is started at all. And of colurse, both FW4 and VC100 is installed...
I have searched the web for hours and hours looking for a solution. Nothing
My postings on local forums and MSDN all results in answers like
"You have a bug"
"Run the debugger and check where it stops"
etc. etc.
Noone seems to care of my initial posting that clearly tells that the error shows at startup/loading of the DLL.
I actually gave up this and changed my .NET application into an EXE file, calling it from Clarion and passing parameters to reach stuff. A silly and lousy workaround, but at least, the program does what it is supposed to do. But I thought, what the heck... I'l give CodeProject a go. Maybe someone here have seen this some time...
-----------------------------
Speaking nordic language?
Why not visiting irc.c-c.no and join #C# or #VisualBasic
-----------------------------
|
|
|
|
|
Member 3712080 wrote: Error 0XC0000005!! The Error shows at loading time, before any code is started at all.
Did you collect any debug information at the time of the error?
Have you got all the correct versions of .NET installed?
Are you sure that the error does not occur within the initialisation code of the DLL?
I must get a clever new signature for 2011.
|
|
|
|
|
Since no code are started at the error time, no debug information is fetched. Allso, As I said, the program using this DLL is created in Clarion. Not possible to debug anything from there unless you refere to dissassembly, wich I have no idea of how to do and read.
All correct versions of .NET Installed??? What do you mean? I have installed FW4. Isnt that enough? Must I allso install the previous frameworks? I thought the different editions was replasing each other...
The DLL has no initialization code.
The DLL has only two API's defined as Export that lets me call into the DLL from my Clarion program. This means that nothing is run in the DLL until I call the API. And since the error shows at startup of my main EXE, wich DONT call the API's at all until tyhe user have logged into the program. The error shows at loading time, not runtime. Therfore I assumes that something is missing.
Allso, when running this in Windows 7 and Windows 2008 there are absolutly no problems at all so the "missing parts" in other OS versions is related to differences between Win7/2008 and WinXP/2003
-----------------------------
Speaking nordic language?
Why not visiting irc.c-c.no and join #C# or #VisualBasic
-----------------------------
|
|
|
|
|
Member 3712080 wrote: Since no code are started at the error time, no debug information is fetched.
I am now even more confused; if no code is started how can you get an error?
Member 3712080 wrote: so the "missing parts" in other OS versions is related to differences between Win7/2008 and WinXP/2003
OK, so you need to check whether your program is using some feature that is not supported in either of these versions.
I must get a clever new signature for 2011.
|
|
|
|
|
Well, when you start an EXE file, the OS runs lots of programs. It prepares the memory, it loads libraries, static data is initialized and of course, there wil be checking of resource existence. Much can go wrong here and yet, the code in the compiled program has not started. Is that so strange?
-----------------------------
Ole Morten Heien
HD Software / Advisor AS
-----------------------------
|
|
|
|
|
Member 3712080 wrote: and yet, the code in the compiled program has not started.
How can you be sure of this, you have not explained where your error occurs.
I must get a clever new signature for 2011.
|
|
|
|
|
I havent?
--------------------------------------------------------------
Anyway, her's the situation:
We have a Win32 application written in Clarion for Windows. This dev tool produces standard Win32 binary similar to C++. The Clarion Compiler is actually a C++ compiler as well as compiling Clarion code so the result is the same
We allso have a large .NET library we want to utilize in this Clarion software. But since Clarion is not .NET compatible or is able to compile managed code, I had to figure out what to do. The answer was quiet simple actually. C++/CLI was what I was looking for. I then created a small C++ DLL that wrapped my .NET library. This works perfectly and everyone is smiling......until we installed the software on our Windows 2003 Terminal server..... DANG!! Error 0XC0000005!! The Error shows at loading time, before any code is started at all. And of colurse, both FW4 and VC100 is installed...
---------------------------------------------------------------
As I said here: "The error shows at loading time", hence, no code is started yet. Let me explain the flow in my program:
App.EXE starts:
All DLL's are loaded by the OS. This I know becuase if some DLL's of mine is missing I will be told.
Next, the program do lots of initialization of databases and stuff and User is presented a Login dialog
User loggs in. I then checks the settings for this user if he/her has a license to use my .NET components. If the user have this license, the API in the DLL is called and presents the user with a GUI created in C#
Now, since the absolutly first call to my C++ DLL is done AFTER the login, then I am pretty sure no code has run in front of the error.
An argument against this would of course be if the C++ DLL had some constructors of any kind that would be started when the DLL is loaded, but it has none. And of course, if it DID have one, dont you think the error would have shown regardless of the OS?
I am 99% certain that the error is in some missing components in the OS and 1% certain that ther might be a switch setting in my C++ project that is wrong. I must admit, I have NO knowledge of how C++ works. This is my absolute first project in C++ and it contains nearly nothing, other than ONE abstract class (the interface) and one class that inherits the interface. When I call the API I send in a Clarion Interface, wich is binary compatible with an abstract class in C++. Then I instantiate my wrapper class. I then return the interface of the C++ class. This interface has methods that will call the .NET components. This works 100% nive in Win7 and Win2008. Since the problem ONLY appears on WinXP and WIn2003 it tells me that something is missing
My first thought was that the framework was not complete or maybe there was something with the VC100 runtime, but I cant see any missing parts. I know for a fact that running a .NET 4 program on a computer with no framework will result in 0xC0000005 message, just like my problem so therfore I'm 99% certain of the missing parts in the OS
You can test this wery easly. Just create a .NET project with FW4 and try running this on a FW2.0 computer. There are no FW version check at all. Just the error message....
-----------------------------
Ole Morten Heien
HD Software / Advisor AS
-----------------------------
|
|
|
|
|
Some suggestions:
* Try loading your DLL in Depends (from the Windows SDK) on XP. That will show you if there's a dependent DLL that's not preset on XP.
* Run fuslogvw.exe (part of the .NET SDK) and look for entries related to your Clarion app. It's possible that the .NET loader (fusion) is logging a more meaningful error when your assembly (DLL) is loaded.
* Check the OS event viewer logs. I've had stack traces show up in there sometimes when things aren't loading.
* Try writing a simple Win32 C++ app which loads your DLL and calls a dummy entry point to be sure that it's loadable *at all* on that OS. If not, it's probably a dependency issue like I mentioned above. If it's loadable then clearly it's an interaction with the Clarion app.
* Load your DLL project in dev studio and set the Clarion exe as the debug exe and check the boxes to break for All exceptions under Debug > Exceptions... when the load fails, is there any first-chance excetion triggered preceding the failure? (this one's a long-shot)
* Try using Procmon from sysinternals.com and monitor disk activity. Set the filter to include only you exe process name to remove lots of unrelated output. See if there are failures reported before the DLL load fails.
* Does your exported function happen to call code from another C# assembly you've created? If so, the related assembly may not be getting located properly as .NET searches in the .exe directory, not in the C++ DLL's directory. The first function using a type from the C# assembly can fail unless you've handled the AppDomain.AssemblyResolve event.
Good luck,
John
ps. I used Clarion back in 1990 or so...was DOS-based then. Wonder if its the same thing.
|
|
|
|
|
|
Hi all,
I'm building a "usercontrol" that has a contextmenustrip on it.
All is fine until I try to add an image to an item, it compliles ok but get a runtime error!
An unhandled exception of type 'System.Resources.MissingManifestResourceException' occurred in mscorlib.dll
Additional information: Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "HexBox.HexEditBox.resources" was correctly embedded or linked into assembly "HexEditBox" at compile time, or that all the satellite assemblies required are loadable and fully signed.
I can only assume that it can not find the resource!
I checked the .resx file and the resource (image) is there.
Maybe it needs the be somewhere else, or a different process is require to use the contextmenustrip on a user control.
I tried the same process on a "form" and as expected all compiles and run as it should.
Using VS2008 Framework 3.5
Any help is appreciated.
Milton.
|
|
|
|
|
Hi!
Is there any function to create an XML file from Managed C++/CLI code(like System::IO::File::Create(L"Test.ini"); for plain files). I've to create an XML file from Managed C++/CLI code and write the following contents in it.
<?xml version='1.0'?>
<request>
<properties name="App_Path">E:\\Innosetup_files\\SG888\\</properties>
<properties name="langselected">en</properties>
</request>
How to create an XML file from Managed C++/CLI code and Write above contents? I've all the above contents in System::String^ variable.
modified on Thursday, March 10, 2011 8:08 AM
|
|
|
|
|
I think you are asking about System::XmlWriter[^].
I must get a clever new signature for 2011.
|
|
|
|