我该如何书写和调用这种类型
How do i write and call this type
我这里有个问题,问题是hService
是0
我有或创建Windows窗体应用程序,我已经放:
HSERVICE hService=0;
BOOL fSuccess=EXIT_SUCCESS;
if(Wfs_Startup())
{
// This returns a successful startup even if I write something here
// to be displayed by a textbox it does. That means the Startup is ok.
if(Wfs_Open(&hService))
{
// What ever I put here doesn't show on a textbox and the application jumps to
// the exception of this block which means there's a problem here, at first I
// thought it was because of no corresponding logical name on a registry but what
// I found out was that if I check below the Startup block and check the hService
// it's 0 so it doesn't receive the correct data from the startup.
}
}
所以我从"我会说"这个函数中得到了这个:
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdDLine,
int nShowCmd)
{
//THE CODE BLOCK IS THE SAME AS THE ABOVE THAT GOES HERE.
}
所以我把内部代码块带到了FormLoad
,但这给了我上面提到的问题,我可以同时拥有FormLoad
和WinMain
吗?因为我试着用WinMain
,但出现了一个错误,我想它说不可能有两个Main或类似的东西。此外,我如何在FormLoad
中调用WinMain
,因为当我尝试时,它需要包含参数,而主要问题是我无法在FormLoad
中添加参数。
关于我该如何解决这个问题,有什么建议吗?
抱歉,但不知道简单的解释方法。但是请记住hService返回0的问题。
好的,只是为了简化这个问题:
如何调用这种开头以HRESULT开头的函数,请查看上面的内容。我想要的是激发那个函数,我认为这会简化它,尽管在FormLoad上调用它还有另一个问题,但首先我想知道如何调用/激发那种函数?
问题是IDE说我不能在Windows窗体上使用int WinMain,因为它已经有了类似的东西,但当我使用命令时,它就可以工作了。我可以有WinMain和Main,但不能让WinMain和FormLoad不在项目或页面内。为了理解,请创建一个Windows窗体应用程序,并尝试键入int WinMain代码,你会在这里看到我的问题所在。
我找到了一个很棒的教程,它为我遇到这个问题提供了一个很好的理由:
https://msdn.microsoft.com/en-us/library/bb384843.aspx
相关文章:
- 什么时候调用组成单元对象的析构函数
- 对RValue对象调用的LValue ref限定成员函数
- 为什么使用 "this" 指针调用派生成员函数?
- 函数调用中参数的顺序重要吗
- OpenGL - 在抛出"__gnu_cxx::recursive_init_error"实例后终止调用?
- 基于另一个成员参数将函数调用从类传递给它的一个成员
- 为什么我的C#代码在调用回C++COM直到Task时会暂停.等待/线程.加入
- 在c++类上调用void函数
- 为什么 std::unique 不调用 std::sort?
- 调用专用模板时出错"no matching function for call to [...]"
- 选择要调用的构造函数
- C++为什么尽管我调用了void函数,它却不起作用
- 构造函数正在调用一个使用当前类类型的函数
- 变量没有改变?通过向量的函数调用
- 没有为自己的结构调用列表推回方法
- 调用'begin(int [n])'没有匹配函数
- 什么时候调用析构函数
- 如何用参数值调用函数(仅在运行时已知)
- std::cout.imbue()多重调用
- 函数何时会在c++中包含stack_Unwind_Resume调用