|
I tried base64 with no joy.......... 
|
|
|
|
|
Hello!
Usually I show errors to the user by handling the Application.ThreadException event. This works fine for the button1_Click() method (message box appears) but I do not get a message box from the DragDrop handler (see code below). Why?
public partial class Form1 : Form
{
public Form1() {
InitializeComponent();
textBox2.AllowDrop = true;
Application.ThreadException += OnThreadException;
}
void OnThreadException(object sender, ThreadExceptionEventArgs e) {
MessageBox.Show(e.Exception.Message);
}
private void button1_Click(object sender, EventArgs e) {
throw new ApplicationException("button1_Click");
}
private void textBox1_MouseDown(object sender, MouseEventArgs e) {
DoDragDrop(sender, DragDropEffects.All);
}
private void textBox2_DragEnter(object sender, DragEventArgs e) {
e.Effect = e.AllowedEffect;
}
private void textBox2_DragDrop(object sender, DragEventArgs e) {
MessageBox.Show("I'm here!");
throw new ApplicationException("You'll never see this :-(");
}
}
-----------------
Alex
|
|
|
|
|
|
Darn! Trotzdem Danke...
(BTW the link says it's not a bug but a feature.)
-----------------
Alex
|
|
|
|
|
I have the code of an old C library that acts as a very basic add-on module for FS (MS Flight Simulator). Since I'm just a simple .NET developer I have no clue how to convert this code into .NET code, in a way it still is compatible with FS. I thought the best solution was to convert it into a managed C++ library, and include this library in my C# project. However, since I'm not a very experienced C/C++ developer I don't know how to do this. Converting it directly into C# code would be perfect, ofcourse, but I don't know if that's possible.
Is this possible at all? Maybe someone can point me in the right direction? I would be very grateful!
This code just adds a menu item to the FS menubar.
The header file:
<br />
#ifndef __FS_MODULE_H__<br />
#define __FS_MODULE_H__<br />
<br />
#define DLLEXPORT __declspec(dllexport)<br />
#define FSAPI __stdcall<br />
<br />
<br />
typedef struct _MODULE_IMPORT {<br />
struct {<br />
int fnID;<br />
PVOID fnptr;<br />
} IMPORTSentry;<br />
struct {<br />
int fnID;<br />
PVOID fnptr;<br />
} nullentry;<br />
} MODULE_IMPORT;<br />
<br />
<br />
typedef struct _MODULE_LINKAGE {<br />
int ModuleID;<br />
void (FSAPI *ModuleInit)(void);<br />
void (FSAPI *ModuleDeinit)(void);<br />
UINT32 ModuleFlags;<br />
UINT32 ModulePriority;<br />
UINT32 ModuleVersion;<br />
PVOID ModuleTable;<br />
} MODULE_LINKAGE;<br />
<br />
#endif /* __FS_MODULE_H__ */<br />
The main file:
<br />
#include <windows.h><br />
#include "module.h"<br />
<br />
<br />
DLLEXPORT MODULE_IMPORT ImportTable = {<br />
{0x00000000, NULL},<br />
{0x00000000, NULL}<br />
};<br />
<br />
void FSAPI module_init(void) {}<br />
void FSAPI module_deinit(void) {}<br />
<br />
DLLEXPORT MODULE_LINKAGE Linkage = {<br />
0x00000000,<br />
module_init,<br />
module_deinit,<br />
0,<br />
0,<br />
0x0900,
NULL<br />
};<br />
<br />
WNDPROC oldWndProc;<br />
<br />
HWND hFSimWindow;<br />
<br />
#define MENU_ENTRY "My Mo&dule"<br />
#define ID_MY_MENUITEM 40001<br />
<br />
<br />
LRESULT CALLBACK FSimWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)<br />
{<br />
switch (uMsg) {<br />
case WM_NCPAINT:<br />
{<br />
HMENU hMenu, hMyMenu;<br />
<br />
hMenu = GetMenu(hwnd);<br />
if (hMenu != NULL) {<br />
int i;<br />
for (i = 0; i < GetMenuItemCount(hMenu); i++) {<br />
char buf[128];<br />
GetMenuString(hMenu, i, buf, 128, MF_BYPOSITION);<br />
if (strcmp(buf, MENU_ENTRY) == 0) {<br />
break;<br />
}<br />
}<br />
if (i < GetMenuItemCount(hMenu)) {<br />
break;<br />
}<br />
<br />
hMyMenu = CreateMenu();<br />
AppendMenu(hMyMenu, MF_STRING | MF_ENABLED, ID_MY_MENUITEM, "My &First Menu Entry");<br />
AppendMenu(hMenu, MF_STRING | MF_POPUP, (UINT_PTR)hMyMenu, MENU_ENTRY);<br />
}<br />
}<br />
break;<br />
case WM_COMMAND:<br />
if (LOWORD(wParam) == ID_MY_MENUITEM) {<br />
MessageBox(hwnd, "It works!", "HURA", MB_OK | MB_ICONEXCLAMATION);<br />
return 0;<br />
}<br />
break;<br />
}<br />
return CallWindowProc(oldWndProc, hwnd, uMsg, wParam, lParam);<br />
}<br />
<br />
<br />
BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved)<br />
{<br />
switch (fdwReason) {<br />
case DLL_PROCESS_ATTACH:<br />
hFSimWindow = FindWindow("FS98MAIN", NULL);<br />
oldWndProc = (WNDPROC)SetWindowLong(hFSimWindow, GWL_WNDPROC, (LONG)FSimWindowProc);<br />
break;<br />
}<br />
return TRUE;<br />
}<br />
From what I understand, the DllMain function is the most problematic part, since .NET doesn't support DllMain??
Thank you in advance for your help!
Joost
|
|
|
|
|
Correct. I don't believe you can write a non COM dll that plays with unmanaged code in C#. Why do you need to convert this code ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Well, I've heard this is the way to write FS modules that will be initialized automatically when FS starts. But I guess it's not possible then? I thought it would maybe be possible with MC++ in .NET 2.0, since it supports a mix up of old C++ code and MC++ code in one project (great feature BTW!). But I don't have a lot of experience with C nor C++ so I really have a clue if I'm right.
Well, maybe it's time to buy a good old C learning book then
Joost Huizinga
|
|
|
|
|
Joost Huizinga wrote: I thought it would maybe be possible with MC++ in .NET 2.0, since it supports a mix up of old C++ code and MC++ code in one project
Yeah, that should work. There's no reason I can see why you couldn't write a plain old dll in MC++. Not C# though.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
does it work with all webservers or only IIS ?
I use both VC# express and Borland C# builder and
VC# is using disco while C# builder uses uddi,
but both produce very look alike References.cs
also is it possible to query a website on available webservises
outside of IDE, like from executable, post disco and get back
wsdl.
explanations, references or links would be greatly appriciated.
TIA
|
|
|
|
|
if ILease.Renew will renew the lease why
would one ever use ISponsor for the same purpose ?
|
|
|
|
|
Hi ppl,
I tried to call COM+ services on other machines by using my local .NET framework. I set up the COM+ components on the other machine for server application usage. Further I want to use C# to call the services.
Does anybody have an idea how I can realize this scenario? I heard I should use DCOM but can't find information about using DCOM in the above scenario...
Thanks for your help,
Olmo
|
|
|
|
|
|
Hi Everybody,
We can convert our image's format to ten (.Bmp .Emf .Exif .Gif .Icon .Jpeg .MemoryBmp .Png .Tiff .Wmf) different image formats using System.Drawing.Imaging in C# via .net Framework 1.1
But, i also want to convert my image to other image fotmats as TGA,SVG etc. in C# too.
So how can i do this?
Is there any method or advice for me?
Please help me..
Thanks for your advices....
|
|
|
|
|
idris cinn wrote: SVG
svg is not an image format at all. It's a vector format.
You need to write your own code for these conversions. You also need to stop the annoying strong/bold tags in your posts.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi all can Any One Pleas tell the Procedure to Install Visual Studio in a System (which is not connected to lan/net) from Installing OS to VS.net
|
|
|
|
|
You REALLY need to have a connection to the 'Net. Not for installing VS.NET, but to patch up the OS after it's installed.
Install the OS.
Install the OS's latest Service Pack from CD.
[Patch the OS to latest from Windows Update]
Insert the Visual Studio CD.
After the CD auto-plays, click the first item in the installation list. You can follow along from the on-screen instructions.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Can I install SQL Server Any Time after installing VS or before installing VS
|
|
|
|
|
You didn't say anything about this in your original post. Install it before you install VS.NET.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hello all,
can i give XML style comments in VC++.Net. so that i can have in built documentation. Is it possible in VC++.net. If so am i need to set any settings at the time of building the project.
Thanking u in advance.
regards,
Basheer
|
|
|
|
|
Is this possible? I have to make a project for school and I chose to do it in C#. Is there any way that I can run a .NET application on a computer without the installed framework? (copy the class files + other files on a CD or something)
Thanks
|
|
|
|
|
mihai_1529 wrote: Is this possible?
The standard is answer is No. You have to install the same version of the .NET Framework that you developed your app against.
There are exceptions to this, but those tools cost a bundle of $$$.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
So, what are the solutions?
Thanks
|
|
|
|
|
Probably installing the framework...
It can be downloaded freely from the microsoft site.
|
|
|
|
|
the .net framework installer has about 20 megs.. maximum.. i don't think this can be a problem for anyone to download and export to a removable media.
Ravenash
|
|
|
|
|
Well, a simple search for ".NET native compiler" reveals, Salamander[^]. It's $500US minimum. Are you really willing to spend that kind of cash on a class project?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|