Click here to Skip to main content
15,923,087 members
Home / Discussions / C#
   

C#

 
GeneralRe: Threading using the ref statement? Wha Happen? Pin
Heath Stewart27-Oct-03 10:08
protectorHeath Stewart27-Oct-03 10:08 
GeneralRe: Threading using the ref statement? Wha Happen? Pin
jremignanti27-Oct-03 10:36
jremignanti27-Oct-03 10:36 
GeneralRe: Threading using the ref statement? Wha Happen? Pin
Heath Stewart27-Oct-03 10:43
protectorHeath Stewart27-Oct-03 10:43 
GeneralRe: Threading using the ref statement? Wha Happen? Pin
jremignanti27-Oct-03 10:54
jremignanti27-Oct-03 10:54 
GeneralRe: Threading using the ref statement? Wha Happen? Pin
Heath Stewart27-Oct-03 10:55
protectorHeath Stewart27-Oct-03 10:55 
GeneralRe: Threading using the ref statement? Wha Happen? Pin
jremignanti27-Oct-03 11:17
jremignanti27-Oct-03 11:17 
GeneralAllowDrop Property Problem Pin
Volker Jacobsen27-Oct-03 3:14
Volker Jacobsen27-Oct-03 3:14 
GeneralRe: AllowDrop Property Problem Pin
Heath Stewart27-Oct-03 8:44
protectorHeath Stewart27-Oct-03 8:44 
This is a threading problem. "Drag&Drop" registration includes a call to OleInitialize, which must be called on an STA (which all processes should be anyway). What does this mean? Well, first take a look at the STAThreadAttribute. Apply that to your entry point (Main). Second, and in some cases*, you may have to call Thread.CurrentThread.ApartmentState = ApartmentState.STA before calling Application.Run (starts your application message pump):
public class MyApp : Form
{
  private MyApp()
  {
  }
  [STAThread]
  public static void Main()
  {
    Thread.CurrentThread.ApartmentState = ApartmentState.STA;
    Application.Run(new MyApp());
  }
}
* Those rare cases happen when the application is invoked in an MTA, like Internet Explorer invoking the app via IEExec.exe for Internet-deployed, touchless installations. The STAThreadAttribute does not seem to affect the runtime, so I had to include that one-liner hack.

 

-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
GeneralRe: AllowDrop Property Problem Pin
Volker Jacobsen27-Oct-03 20:46
Volker Jacobsen27-Oct-03 20:46 
GeneralTwo ImageList and two ImageIndex (and maybe... useful source code for you) Pin
god4k27-Oct-03 1:36
god4k27-Oct-03 1:36 
GeneralRe: Two ImageList and two ImageIndex (and maybe... useful source code for you) Pin
Heath Stewart27-Oct-03 2:37
protectorHeath Stewart27-Oct-03 2:37 
QuestionHow do I catch Windows messages in c#?? Pin
IrishSonic27-Oct-03 0:03
IrishSonic27-Oct-03 0:03 
AnswerRe: How do I catch Windows messages in c#?? Pin
Heath Stewart27-Oct-03 2:13
protectorHeath Stewart27-Oct-03 2:13 
AnswerRe: How do I catch Windows messages in c#?? Pin
oOomen27-Oct-03 4:58
oOomen27-Oct-03 4:58 
GeneralFOCUS Pin
oOomen26-Oct-03 20:27
oOomen26-Oct-03 20:27 
GeneralRe: FOCUS Pin
Heath Stewart27-Oct-03 2:25
protectorHeath Stewart27-Oct-03 2:25 
GeneralRe: FOCUS Pin
oOomen27-Oct-03 5:01
oOomen27-Oct-03 5:01 
GeneralRe: FOCUS Pin
allancto27-Oct-03 18:32
allancto27-Oct-03 18:32 
GeneralRe: FOCUS Pin
oOomen28-Oct-03 2:38
oOomen28-Oct-03 2:38 
GeneralRe: FOCUS Pin
oOomen28-Oct-03 2:52
oOomen28-Oct-03 2:52 
GeneralRe: FOCUS Pin
Heath Stewart28-Oct-03 2:54
protectorHeath Stewart28-Oct-03 2:54 
GeneralRe: FOCUS Pin
oOomen28-Oct-03 2:58
oOomen28-Oct-03 2:58 
QuestionHow to display store procedure list in Ms Access? Pin
god4k26-Oct-03 14:17
god4k26-Oct-03 14:17 
AnswerRe: How to display store procedure list in Ms Access? Pin
Heath Stewart26-Oct-03 17:17
protectorHeath Stewart26-Oct-03 17:17 
GeneralRe: There is stored procedure in MS Access Pin
Edbert P27-Oct-03 12:08
Edbert P27-Oct-03 12:08 

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.