Click here to Skip to main content
15,887,135 members
Home / Discussions / C#
   

C#

 
QuestionHow to use MF_BYPOSITION parameter in InsertMenu Function Pin
Loithuxua30-Apr-11 16:37
Loithuxua30-Apr-11 16:37 
AnswerRe: How to use MF_BYPOSITION parameter in InsertMenu Function Pin
OriginalGriff30-Apr-11 20:29
mveOriginalGriff30-Apr-11 20:29 
GeneralRe: How to use MF_BYPOSITION parameter in InsertMenu Function Pin
David198730-Apr-11 21:00
David198730-Apr-11 21:00 
GeneralRe: How to use MF_BYPOSITION parameter in InsertMenu Function Pin
OriginalGriff30-Apr-11 21:04
mveOriginalGriff30-Apr-11 21:04 
GeneralRe: How to use MF_BYPOSITION parameter in InsertMenu Function Pin
Dave Kreskowiak1-May-11 3:38
mveDave Kreskowiak1-May-11 3:38 
AnswerRe: How to use MF_BYPOSITION parameter in InsertMenu Function Pin
I Believe In GOD1-May-11 1:42
I Believe In GOD1-May-11 1:42 
QuestionUsing own .dll in 64 bit version system - exception: ""BadImageFormatException was unhandled"" Pin
Cadi210830-Apr-11 10:20
Cadi210830-Apr-11 10:20 
AnswerRe: Using own .dll in 64 bit version system - exception: ""BadImageFormatException was unhandled"" [modified] Pin
Luc Pattyn30-Apr-11 10:43
sitebuilderLuc Pattyn30-Apr-11 10:43 
Here are some facts relating to 32/64 bit code:

1.
When you build a native-code DLL, you must decide whether you want it to use the 32-bit or the 64-bit architecture, which are both supported by most modern Intel/AMD processors.

2.
When you build a managed code DLL or EXE, you can choose between 32-bit, 64-bit, or automatic ("AnyCPU"). With 32-bit or 64-bit, it is the EXE itself that enforces the execution mode; with "AnyCPU" the EXE will run in 32-bit execution on 32-bit Windows, and in 64-bit execution on 64-bit Windows.

3.
And you can't mix 32-bit and 64-bit code in a single process, Windows simply doesn't allow a mode switch in mid execution, so the DLLs must match the EXE's mode (AnyCPU DLLs are always fine, the other managed ones and all unmanaged ones must match).


Assembly code is native code obviously, and 64-bit and 32-bit assembly source files look quite different, as the programming model is not the same at all. So I guess your "ASM DLL" really is a 32-bit beast, notwithstanding the fact that you created it on a 64-bit Win7 system.

So you could use your 32-bit native DLL, and use it on any 32-bit operating system (with a managed EXE built for x86 or for AnyCPU); or use it on a 64-bit OS with a managed EXE built for x86 (but not for "AnyCPU" as that would start in 64-bit mode and then fail to reference the DLL code).

In practice, you could simply rebuild the app (the EXE part should suffice) for x86, see the project properties. There also is a hack using CORFLAGS, which basically would alter the properties of an existing EXE file (not recommended when you have the source code anyhow).

Smile | :)
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.
modified on Saturday, April 30, 2011 5:16 PM

GeneralRe: Using own .dll in 64 bit version system - exception: ""BadImageFormatException was unhandled"" Pin
Cadi210830-Apr-11 23:14
Cadi210830-Apr-11 23:14 
AnswerRe: Using own .dll in 64 bit version system - exception: ""BadImageFormatException was unhandled"" Pin
Ghydo1-May-11 8:43
Ghydo1-May-11 8:43 
GeneralRe: Using own .dll in 64 bit version system - exception: ""BadImageFormatException was unhandled"" Pin
Cadi21081-May-11 9:50
Cadi21081-May-11 9:50 
GeneralRe: Using own .dll in 64 bit version system - exception: ""BadImageFormatException was unhandled"" Pin
Ghydo1-May-11 11:07
Ghydo1-May-11 11:07 
GeneralRe: Using own .dll in 64 bit version system - exception: ""BadImageFormatException was unhandled"" Pin
Cadi21082-May-11 0:26
Cadi21082-May-11 0:26 
AnswerRe: Using own .dll in 64 bit version system - exception: ""BadImageFormatException was unhandled"" Pin
Luc Pattyn2-May-11 15:10
sitebuilderLuc Pattyn2-May-11 15:10 
GeneralRe: Using own .dll in 64 bit version system - exception: ""BadImageFormatException was unhandled"" Pin
Cadi21082-May-11 23:36
Cadi21082-May-11 23:36 
Questioni need a help with an analog clock in c# Pin
stranger8030-Apr-11 9:54
stranger8030-Apr-11 9:54 
AnswerRe: hi Pin
Luc Pattyn30-Apr-11 10:14
sitebuilderLuc Pattyn30-Apr-11 10:14 
GeneralRe: hi Pin
stranger8030-Apr-11 10:30
stranger8030-Apr-11 10:30 
QuestionHow do I take the content from a javascript variable, and paste it into a c# variable? Pin
_Q12_30-Apr-11 6:59
_Q12_30-Apr-11 6:59 
AnswerRe: How do I take the content from a javascript variable, and paste it into a c# variable? Pin
Dave Kreskowiak30-Apr-11 10:04
mveDave Kreskowiak30-Apr-11 10:04 
AnswerRe: How do I take the content from a javascript variable, and paste it into a c# variable? Pin
Eddy Vluggen30-Apr-11 22:13
professionalEddy Vluggen30-Apr-11 22:13 
GeneralRe: How do I take the content from a javascript variable, and paste it into a c# variable? Pin
_Q12_5-May-11 8:26
_Q12_5-May-11 8:26 
GeneralRe: How do I take the content from a javascript variable, and paste it into a c# variable? Pin
Eddy Vluggen5-May-11 9:21
professionalEddy Vluggen5-May-11 9:21 
QuestionUsings for "ManagementClass" in Visual C# 2010 Pin
rms12330-Apr-11 2:28
professionalrms12330-Apr-11 2:28 
AnswerRe: Usings for "ManagementClass" in Visual C# 2010 Pin
Philippe Mori30-Apr-11 2:39
Philippe Mori30-Apr-11 2:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.