高手进来,.net调用vb非模式窗体问题

zyguyue 2006-12-28 07:39:00
最近作一个项目,用.net包原有的vb功能,通过引用dll调用,但是无法将vb非模式窗体show出来,所以我们在vb的dll中使用了API函数将其显示在.net窗体上。但是问题出来了,有一个vb窗体上有个RichText控件,现在无法使用回车换行、无法支持五笔输入法,Ctrl+C,Ctrl+V失效以及其他问题。
我们怀疑是否这些触发了什么windows消息,然后被.net背后的窗体或者.net框架底层捕获走了,哪位高人是否遇到过这种问题,万请相告解决,高分相送。
...全文
281 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
KenYuan2016 2007-03-27
  • 打赏
  • 举报
回复
编为*.ocx 调用
leixueqiyi 2007-03-26
  • 打赏
  • 举报
回复
需要做成非托管的dll
How to call assembly in C#
Let's do an experiment with inline assembly in a DLL. I can not call assembly language from C# but I know I can call unmanaged DLLs from C#. I'll make a DLL which calculates the speed of CPU, vendor name, Family, Model and Stepping of CPU using in line assembly language.

Program 7
// SysInfo.cpp
// written by Zeeshan Amjad

#include "SysInfo.h"

BOOL __stdcall DllMain(HINSTANCE hInst, DWORD dwReason, LPVOID lpReserved) {
return TRUE;
}

extern "C" __declspec(dllexport) int __stdcall getCPUSpeed() {
LARGE_INTEGER ulFreq, ulTicks, ulValue, ulStartCounter, ulEAX_EDX, ulResult;

// it is number of ticks per seconds
QueryPerformanceFrequency(&ulFreq);

// current valueofthe performance counter
QueryPerformanceCounter(&ulTicks);

// calculate one second interval
ulValue.QuadPart = ulTicks.QuadPart + ulFreq.QuadPart;

// read time stamp counter
// this asm instruction load the highorder 32 bit of the register into EDX
// and the lower order 32 bits into EAX
_asm {
rdtsc
mov ulEAX_EDX.LowPart, EAX
mov ulEAX_EDX.HighPart, EDX
}

// start no of ticks
ulStartCounter.QuadPart = ulEAX_EDX.QuadPart;

// loop for 1 second
do {
QueryPerformanceCounter(&ulTicks);
} while (ulTicks.QuadPart <= ulValue.QuadPart);

// get the actual no of ticks
_asm {
rdtsc
mov ulEAX_EDX.LowPart, EAX
mov ulEAX_EDX.HighPart, EDX
}

// calculate result
ulResult.QuadPart = ulEAX_EDX.QuadPart - ulStartCounter.QuadPart;

return (int)ulResult.QuadPart / 1000000;
}

extern "C" __declspec(dllexport) char* __stdcall getCPUType() {
static char pszCPUType[13];
memset(pszCPUType, 0, 13);

_asm {
mov eax, 0
cpuid

// getting information from EBX
mov pszCPUType[0], bl
mov pszCPUType[1], bh

ror ebx, 16
mov pszCPUType[2], bl
mov pszCPUType[3], bh

// getting information from EDX
mov pszCPUType[4], dl
mov pszCPUType[5], dh

ror edx, 16
mov pszCPUType[6], dl
mov pszCPUType[7], dh

// getting information from ECX
mov pszCPUType[8], cl
mov pszCPUType[9], ch

ror ecx, 16
mov pszCPUType[10], cl
mov pszCPUType[11], ch
}

pszCPUType[12] = '\0';

return pszCPUType;
}

extern "C" __declspec(dllexport) int __stdcall getCPUFamily() {
int retVal;

_asm {
mov eax, 1
cpuid
mov retVal, eax
}

return (retVal >> 8);
}

extern "C" __declspec(dllexport) int __stdcall getCPUModel() {
int retVal;

_asm {
mov eax, 1
cpuid
mov retVal, eax
}

return ((retVal >> 4 ) & 0x0000000f);
}

extern "C" __declspec(dllexport) int __stdcall getCPUStepping() {
int retVal;

_asm {
mov eax, 1
cpuid
mov retVal, eax
}

return (retVal & 0x0000000f);
}

Here is a simple client of this DLL which is written in VC++ to check the functionality of this.
liangzhao123 2007-03-04
  • 打赏
  • 举报
回复
关注
zhaozhq 2007-03-01
  • 打赏
  • 举报
回复
兄弟,俺是新手,现在遇到一个问题,如何将dll中的vb窗体显示在.net窗体上啊?请指点迷津.
feeling3 2006-12-30
  • 打赏
  • 举报
回复
帮你顶,我也遇到了相同的问题
zyguyue 2006-12-29
  • 打赏
  • 举报
回复
木有人知道么
阿非 2006-12-28
  • 打赏
  • 举报
回复
帮顶一下~

13,190

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 分析与设计
社区管理员
  • 分析与设计社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧