|
If it's a console app then you can only pass parameters to it on invocation, i.e. in your CreateProcess() call. If it's a Windows app then you can use SendMessage() to send private messages to it.
The best things in life are not things.
|
|
|
|
|
Hi,
I have one linux cpp executable file. i want how to run this executable file in windows OS?.
please give any idea? or urls
Regards,
M.Mathivanan
|
|
|
|
|
Hi,
1.
you're in the wrong forum, C++ on Linux most likely will be "native C++", not be "managed .NET code".
2.
it has been many years ago I last did this, back then "cygwin" was the answer. Try Googling it.
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.
|
|
|
|
|
If you have Windows 7 Ultimate or Enterprise, you can install the 'Subsystem for Unix-based Applications' (SUA) which you get a Windows compatible gcc compiler with g++ and all the Unix/Linux goodies. You will have to re-compile your C++ file in this new Posix environment for it to run in Windows.
For into how to install go to: http://www.suacommunity.com/SUA.aspx[^]
|
|
|
|
|
mathivanaan wrote: please give any idea?
1. Recode it so it is a windows code, and then recompile. This could be a lot of work or little work depending on what the executable does.
2. Find/write a simulator/virtual machine that 'runs' an execuble from the targeted system on windows.
3. Create a server that runs on a linux box. It runs the executable. It has a communications API. Your Windows app talks to that server.
In the above 2 is probably the most difficult solution by far.
|
|
|
|
|
Hi, I'm traying to use Berkeley DB in C++/CLI with /clr mode. I wrote two applications, one will store to a database and another one will try to read the contents of that database, but i failed in doing that!
This the first code (first app) for writing to a database:
#include "stdafx.h"
#pragma comment(lib,"libdb51")
using namespace System;
using namespace System::Runtime::InteropServices;
int main(array<System::String ^> ^args)
{
Db SigDb(0,0);
unsigned int oFlags= DB_CREATE;
SigDb.open(NULL,"SigDb.db",0,DB_BTREE,oFlags,0);
String^ HexSig="1E81F1C1176434";
wchar_t* a=( wchar_t* )Marshal::StringToHGlobalUni(HexSig).ToPointer() ;
wchar_t* A=( wchar_t* )Marshal::StringToHGlobalUni(HexSig).ToPointer();;
Dbt key1(a,100);
Dbt data1(A,100);
int ret= SigDb.put(NULL,&key1,&data1, DB_NOOVERWRITE);
if(ret==DB_KEYEXIST){
Console::WriteLine("You are trying to insert an exist key!");
}
SigDb.close(0);
Marshal::FreeHGlobal(IntPtr(A));
Marshal::FreeHGlobal(IntPtr(a));
return 0;
}
and this is the second code for reading from the database:
#include "stdafx.h"
#pragma comment(lib,"libdb51")
using namespace System;
using namespace System::Runtime::InteropServices;
int main(array<System::String ^> ^args)
{
Db SigDb(0,0);
unsigned int oFlags= DB_CREATE;
SigDb.open(NULL,"SigDb.db",0,DB_BTREE,oFlags,0);
String^ HexSig="1E81F1C1176434";
wchar_t* a=( wchar_t* )Marshal::StringToHGlobalUni(HexSig).ToPointer();
SigDb.open(NULL,"SigDb.db",0,DB_BTREE,oFlags,0);
wchar_t DDData[200];
Dbt getKey, getData;
getKey.set_data(a);
getKey.set_size(100);
getData.set_data(DDData);
getData.set_ulen(200);
getData.set_flags(DB_DBT_USERMEM);
if(SigDb.get(NULL,&getKey,&getData,0)==DB_NOTFOUND)
Console::WriteLine("Not Found !");
else
Console::WriteLine(" {0}",Marshal::PtrToStringUni((IntPtr)DDData));
Marshal::FreeHGlobal(IntPtr(a));
Console::ReadLine();
return 0;
}
always the second app says "Not found"! On the other hand when i tried to write the same data twise in the database using the first code, it says "You are trying to insert an exist key!" and that proves that the data was written! Any idea pls!
|
|
|
|
|
As a guess if the data type in the database is char (and not varchar) then normally databases fill the column.
Your usage suggests a column width of 100 but a value that is less than that. A fill character, in my experience, is space. So for your query you must explicitly space fill it yourself.
|
|
|
|
|
I am not sure if i understood you. I made the followin in the second code but still same problem:
wchar_t DDData[14];
Dbt getKey, getData;
getKey.set_data(a);
getKey.set_size(HexSig->Length);
getData.set_data(DDData);
getData.set_ulen(HexSig->Length);
getData.set_flags(DB_DBT_USERMEM);
|
|
|
|
|
If the database data type is 'char', and has a size of 5 and you put 'x' in it then to query for that value you need to use 'x ' (x followed by 4 spaces is a size of 5.)
|
|
|
|
|
I tried to make the key size (In Query operation) dynamic with "for" loop as the code below.. this was without any benefit:
for (int i=1;i<90000000; i++){
getKey.set_size(i);
getData.set_data(DDData);
getData.set_ulen(28);
getData.set_flags(DB_DBT_USERMEM);
if(SigDb.get(NULL,&getKey,&getData,0)!=DB_NOTFOUND)
Console::WriteLine(" {0},,{1}",Marshal::PtrToStringUni((IntPtr)DDData),i);
}
Marshal::FreeHGlobal(IntPtr(a));
Console::WriteLine("Finish");
|
|
|
|
|
Anyone recommend best place to post boost:asio question?
Didn't think this forum is the right place but maybe it is.
|
|
|
|
|
Well there is one obvious place[^].
The best things in life are not things.
|
|
|
|
|
|
hello i'm trying to convert this piece of code from vb
Private Structure IconInfo
Public fIcon As Boolean
Public xHotspot As Int32
Public yHotspot As Int32
Public hbmMask As IntPtr
Public hbmColor As IntPtr
End Structure
<DllImport("user32.dll", EntryPoint:="CreateIconIndirect")> _
Private Shared Function CreateIconIndirect(ByVal iconInfo As IntPtr) As IntPtr
End Function
<DllImport("user32.dll", CharSet:=CharSet.Auto)> _
Public Shared Function DestroyIcon(ByVal handle As IntPtr) As Boolean
End Function
<DllImport("gdi32.dll")> _
Public Shared Function DeleteObject(ByVal hObject As IntPtr) As Boolean
End Function
Public Function CreateCursor(ByVal bmp As Bitmap) As Cursor
'Setup the Cursors IconInfo
Dim tmp As New IconInfo
tmp.xHotspot = _gHotSpotPt.X
tmp.yHotspot = _gHotSpotPt.Y
tmp.fIcon = False
If _gBlackBitBack Then
tmp.hbmMask = bmp.GetHbitmap(Color.FromArgb(0, 0, 0, 0))
tmp.hbmColor = bmp.GetHbitmap(Color.FromArgb(0, 0, 0, 0))
Else
tmp.hbmMask = bmp.GetHbitmap()
tmp.hbmColor = bmp.GetHbitmap()
End If
'Create the Pointer for the Cursor Icon
Dim pnt As IntPtr = Marshal.AllocHGlobal(Marshal.SizeOf(tmp))
Marshal.StructureToPtr(tmp, pnt, True)
Dim curPtr As IntPtr = CreateIconIndirect(pnt)
'Save the image of the cursor with the _gBlackBitBack effect
'Not really needed for normal use.
'I use it to create a screen shot with the gCursor included
_gCursorImage = Icon.FromHandle(curPtr).ToBitmap
'Clean Up
DestroyIcon(pnt)
DeleteObject(tmp.hbmMask)
DeleteObject(tmp.hbmColor)
Return New Cursor(curPtr)
End Function
By now i traslate the all thing into:
public struct IconInfo
{
bool fIcon;
int xHotspot;
int yHotspot;
System::IntPtr hbmMask;
System::IntPtr hbmColor;
};
[System::Runtime::InteropServices::DllImport("user32.dll, EntryPoint:=CreateIconIndirect")]
System::IntPtr CreateIconIndirect(System::IntPtr iconInfo);
[System::Runtime::InteropServices::DllImport("user32.dll, CharSet:=CharSet.Auto")]
bool DestroyIcon(System::IntPtr handle);
[System::Runtime::InteropServices::DllImport("gdi32.dll")]
bool DeleteObject(System::IntPtr handl);
System::Windows::Forms::Cursor ^CreateCursor(Bitmap ^bmp, int xHotSpot, int yHotSpot)
{
IconInfo tmp;
tmp.xHotspot = 3;
tmp.yHotspot = 3;
tmp.fIcon = false;
bool _gBlackBitBack=false;
if (_gBlackBitBack) {
tmp.hbmMask = bmp->GetHbitmap(Color::FromArgb(0, 0, 0, 0));
tmp.hbmColor = bmp->GetHbitmap(Color::FromArgb(0, 0, 0, 0));
}
else {
tmp.hbmMask = bmp->GetHbitmap();
tmp.hbmColor = bmp->GetHbitmap();
}
IntPtr pnt= Marshal::AllocHGlobal(Marshal::SizeOf(tmp));
Marshal::StructureToPtr(%tmp, pnt, true);
IntPtr curPtr = CreateIconIndirect(pnt);
DestroyIcon(pnt);
DeleteObject(tmp.hbmMask);
DeleteObject(tmp.hbmColor);
return gcnew System::Windows::Forms::Cursor(curPtr);
}
the problem is that i get the following error and i don't know how to get it solved:
error C2665: 'System::Runtime::InteropServices::Marshal::SizeOf' : none of the 2 overloads could convert all the argument types
1> c:\windows\microsoft.net\framework\v2.0.50727\mscorlib.dll: could be 'int System::Runtime::InteropServices::Marshal::SizeOf(System::Object ^)'
1> c:\windows\microsoft.net\framework\v2.0.50727\mscorlib.dll: or 'int System::Runtime::InteropServices::Marshal::SizeOf(System::Type ^)'
1> while trying to match the argument list '(test_cursor::IconInfo)'
error C2664: 'System::Runtime::InteropServices::Marshal::StructureToPtr' : cannot convert parameter 1 from 'test_cursor::IconInfo' to 'System::Object ^'
1> No user-defined-conversion operator available, or
1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
|
|
|
|
|
ok i get it
if you wanna know
value class IconInfo
{
public:
bool fIcon;
Int32 xHotspot;
Int32 yHotspot;
IntPtr hbmMask;
IntPtr hbmColor;
};
|
|
|
|
|
Hi!
I've created an application using Managed C++. I've created a setup file using Visual Studio Deployment Project. In the "Dependencies" properties of the ".exe" and "Active Project Output", there is one entry called "Microsoft .NET FrameWork". What to do to run the setup on a machine where Visual Studio and .NET Framework is not installed? Do I need to install .NET Framework at all the machines where I install my setup file?
|
|
|
|
|
Hi,
I am facing a strange problem with the existing code. it suddenly started failing. The problem happens only in one of the machines, while the same code works in other machines.
It fails at the below line.
obj1 = new _objifptr(_uuidof(objif));
I did check that __uuidof returns the correct uuid. but fails when "new _objifprt" is called. The .dll, .tlb and .pdb are all available in the working directory. They have been registered using regasm successfully.
I see that the errors thrown are
FileLoadException followed by TypeInitializationException.
Please help with your thoughts.
Thanks,
Dhana.
|
|
|
|
|
Please post your question in one forum only.
|
|
|
|
|
Hi,
I googled this but I'm still confused. How does one go about adding sound effects to a .Net application?
Thanks.
|
|
|
|
|
Very few people actually frequent this forum. You might have better luck with this question in the C# forum.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Any progress on Intellisense for C++/CLI in VS2010 (Apologies if you read this on the VS board). Been googling and I cant find a satisfactory answer other than return to VS2008...
Ger
|
|
|
|
|
Here's the status as I understand it from watching the vcblog and other postings.
VS2010sp1 doesn't add Intellisense for C++/CLI files. This leaves us to expect it in v.next. I use Visual Assist and like it a lot and that does give me Intellisense in C++/CLI files. VA does get confused sometimes but it's far better than nothing.
VS2010 SP1 is supposed to improve the F12 Go to declaration/definition time for C++ code but I'm not seeing any improvement.
I would love to think that there could be interim updates for C++ users but personally I don't think that'll happen. We can hope though...
Would love to hear newer, better info from anyone.
John
|
|
|
|
|
I separate all of my C++/CLI code into two solutions; one in 2010 and one in 2008....
|
|
|
|
|
I'm not sure how to go about this. What to use to draw the snake to the screen and how to get it to animate properly like grow in size when it collects an item or just moving around the screen. I was told not to use a Picture box but to use Panels and no timers.
http://www.youtube.com/watch?v=s2tlk1LpWjI&feature=related
Maybe start off more simple like in the vid the snake just grows and the entire snake body doesn't move.
Thanks in advance.
modified on Friday, March 25, 2011 8:38 PM
|
|
|
|
|
Well, what's your best guess at how to accomplish this?
Most likely it has something to do with what's been taught most recently. What kinds of graphics features have been gone over?
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|