Search Results

Search found 746 results on 30 pages for 'winapi'.

Page 26/30 | < Previous Page | 22 23 24 25 26 27 28 29 30  | Next Page >

  • Windows Game Loop 50% CPU on Dual Core

    - by Dave18
    The game loop alone is using 50% of CPU Usage, I haven't done any rendering work yet. What i'm doing here? while(true) { if(PeekMessage(&msg,NULL,0,0,PM_REMOVE)) { if(msg.message == WM_QUIT || msg.message == WM_CLOSE || msg.message == WM_DESTROY) break; TranslateMessage(&msg); DispatchMessage(&msg); } else { //Run game code, break out of loop when the game is over } }

    Read the article

  • About Attributes member of LUID_AND_ATTRIBUTES used in TOKEN_PRIVILEGES structure

    - by Astaroth
    MSDN article, Enabling and Disabling Privileges in C++, provided the a code example to show how to enable or disable a privilege in an access token. I quote the part in questioned: tp.PrivilegeCount = 1; tp.Privileges[0].Luid = luid; if (bEnablePrivilege) tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; else tp.Privileges[0].Attributes = 0; What is the meaning of zero value for Attributes member? According to the documentation of TOKEN_PRIVILEGES structure, the attributes of a privilege can be a combination of the following values: SE_PRIVILEGE_ENABLED  (it is 0x00000002L in WinNT.h) SE_PRIVILEGE_ENABLED_BY_DEFAULT  (it is 0x00000001L in WinNT.h) SE_PRIVILEGE_REMOVED  (it is 0x00000004L in WinNT.h) SE_PRIVILEGE_USED_FOR_ACCESS  (it is 0x80000000L in WinNT.h) So, we don't see any valid constant with a value of zero. I guess, the zero is equal to SE_PRIVILEGE_REMOVED. Anybody here could explain what the zero value really does?

    Read the article

  • WM_KEYDOWN confusion

    - by user146780
    I'm trying to get my application to do something when CTRL+S is pressed. I'm just not sure how the W and L params work for WM_KEYDOWN. MSDN has something about bit fields which i'm not sure about. How can I detect CTRL and S? Thanks

    Read the article

  • How do programs handle file "opened with..." them?

    - by hmind
    I am wondering if someone could point me in the right direction. You know how for example, in most IDEs, if you open a source file with "open with", it runs the program and opens it up? and then if you open another one, it opens it in a new tab in the same process? My question is NOT how to add a program to the shell commands, but rather: How would a C# application "receive" a PDF file for example? How would the application open the file in the same process when another file is run with it (not having to instances of the program)?

    Read the article

  • Are UTF16 (as used by for example wide-winapi functions) characters always 2 byte long?

    - by Cray
    Please clarify for me, how does UTF16 work? I am a little confused, considering these points: There is a static type in C++, WCHAR, which is 2 bytes long. (always 2 bytes long obvisouly) Most of msdn and some other documentation seem to have the assumptions that the characters are always 2 bytes long. This can just be my imagination, I can't come up with any particular examples, but it just seems that way. There are no "extra wide" functions or characters types widely used in C++ or windows, so I would assume that UTF16 is all that is ever needed. To my uncertain knowledge, unicode has a lot more characters than 65535, so they obvisouly don't have enough space in 2 bytes. UTF16 seems to be a bigger version of UTF8, and UTF8 characters can be of different lengths. So if a UTF16 character not always 2 bytes long, how long else could it be? 3 bytes? or only multiples of 2? And then for example if there is a winapi function that wants to know the size of a wide string in characters, and the string contains 2 characters which are each 4 bytes long, how is the size of that string in characters calculated? Is it 2 chars long or 4 chars long? (since it is 8 bytes long, and each WCHAR is 2 bytes)

    Read the article

  • What should I use to replace the WinAPI Beep() function?

    - by Jon Cage
    I've got a Visual C++/CLI app which uses beeps to signify good and bad results (used when the user can't see the screen). Currently I use low pitched beeps for bad results and high pitched beeps for good results: if( goodResult == true ) { Beep(1000, 40); } else { Beep(2000, 20); } This works okay on my Vista laptop, but I've tried it on other laptops and some seem to play the sounds for less time (they sound more like clicks than beeps) or the sound doesn't play at all. So I have two questions here: Is there a more reliable beep function? Is there a (simple) way I can play a short .wav file or something similar instead (preferred solution).

    Read the article

  • Controlling the USB from Windows

    - by b-gen-jack-o-neill
    Hi, I know this probably is not the easiest thing to do, but I am trying to connect Microcontroller and PC using USB. I dont want to use internal USART of Microcontroller or USB to RS232 converted, its project indended to help me understand various principles. So, getting the communication done from the Microcontroller side is piece of cake - I mean, when I know he protocol, its relativelly easy to implement it on Micro, becouse I am in direct control of evrything, even precise timing. But this is not the case of PC. I am not very familiar with concept of Windows handling the devices connected. In one of my previous question I ask about how Windows works with devices thru drivers. I understood that for internal use of Windows, drivers must have some default set of functions available to OS. I mean, when OS wants to access HDD, it calls HDD driver (which is probably internal in OS), with specific "questions" so that means that HDD driver has to be written to cooperate with Windows, to have write function in the proper place to be called by the OS. Something similiar is for GPU, Even DirectX, I mean DirectX must call specific functions from drivers, so drivers must be written to work with DX. I know, many functions from WinAPI works on their own, but even "simple" window must be in the end written into framebuffer, using MMIO to adress specified by drivers. Am I right? So, I expected that Windows have internal functions, parts of WinAPI designed to work with certain comonly used things. To call manufacturer-designed drivers. But this seems to not be entirely true becouse Windows has no way to communicate thru Paralel port. I mean, there is no function in the WinAPI to work with serial port, but there are funcions to work with HDD,GPU and so. But now there comes the part I am getting very lost at. So, I think Windows must have some built-in functions to communicate thru USB, becouse for example it handles USB flash memory. So, is there any WinAPI function designed to let user to operate USB thru that function, or when I want to use USB myself, do I have to call desired USB-driver function myself? Becouse all you need to send to USB controller is device adress and the infromation right? I mean, I don´t have to write any new drivers, am I right? Just to call WinAPI function if there is such, or directly call original USB driver. Does any of this make some sense?

    Read the article

  • Creating a service (SERVICE_ACCEPT_SESSIONCHANGE)

    - by Ron
    Hi there, I am trying to create a service following the example documented in the link below: http://msdn.microsoft.com/en-us/library/bb540475(v=VS.85).aspx What I am interested in is to be able to catch user "lock" and "unlock" workstation events. Using the code on from the example provided, I modified the following: Line 15: Original: VOID WINAPI SvcCtrlHandler( DWORD ); Modified: DWORD WINAPI SvcCtrlHandler( DWORD, DWORD, LPVOID, LPVOID ); Line 141: Original: gSvcStatusHandle = RegisterServiceCtrlHandler( SVCNAME, SvcCtrlHandler); Modified: gSvcStatusHandle = RegisterServiceCtrlHandlerEx( SVCNAME, SvcCtrlHandler, NULL); Line 244: Original: SvcStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP; Modified: gSvcStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP|SERVICE_ACCEPT_SESSIONCHANGE; Line 266: Original: VOID WINAPI SvcCtrlHandler( DWORD dwCtrl ) { // Handle the requested control code. switch(dwCtrl) { case SERVICE_CONTROL_STOP: ReportSvcStatus(SERVICE_STOP_PENDING, NO_ERROR, 0); // Signal the service to stop. SetEvent(ghSvcStopEvent); ReportSvcStatus(gSvcStatus.dwCurrentState, NO_ERROR, 0); return; case SERVICE_CONTROL_INTERROGATE: break; default: break; } }` Modified: DWORD WINAPI SvcCtrlHandler( DWORD dwControl, DWORD dwEventType, LPVOID lpEventData, LPVOID lpContext ) { DWORD dwErrorCode = NO_ERROR; switch(dwControl) { case SERVICE_CONTROL_STOP: ReportSvcStatus(SERVICE_STOP_PENDING, NO_ERROR, 0); // Signal the service to stop. SetEvent(ghSvcStopEvent); ReportSvcStatus(gSvcStatus.dwCurrentState, NO_ERROR, 0); break; case SERVICE_CONTROL_INTERROGATE: break; case SERVICE_CONTROL_SESSIONCHANGE: ReportSvcStatus(gSvcStatus.dwCurrentState, NO_ERROR, 0); break; default: break; } return dwErrorCode; } With the changes above, my service compiled and install fine. But when I try to start my service on my Windows 2000 machine, it does not start properly (it will be stuck on the "starting" status) Can anyone please advise? Thank you in advance, Ron

    Read the article

  • C Run-Time library part 2

    - by b-gen-jack-o-neill
    Hi, I was suggested when I have some further questions on my older ones, to create newer Question and reffer to old one. So, this is the original question: What is the C runtime library? OK, from your answers, I now get thet statically linked libraries are Microsoft implementation of C standart functions. Now: If I get it right, the scheme would be as follow: I want to use printf(), so I must include which just tels compiler there us functio printf() with these parameters. Now, when I compile code, becouse printf() is defined in C Standart Library, and becouse Microsoft decided to name it C Run Time library, it gets automatically statically linked from libcmt.lib (if libcmt.lib is set in compiler) at compile time. I ask, becouse on wikipedia, in article about runtime library there is that runtime library is linked in runtime, but .lib files are linked at compile time, am I right? Now, what confuses me. There is .dll version of C standart library. But I thought that to link .dll file, you must actually call winapi program to load that library. So, how can be these functions dynamically linked, if there is no static library to provide code to tell Windows to load desired functions from dll? And really last question on this subject - are C Standart library functions also calls to winapi even they are not .dll files like more advanced WinAPI functions? I mean, in the end to access framebuffer and print something you must tell Windows to do it, since OS cannot let you directly manipulate HW. I think of it like the OS must be written to support all C standart library functions same way across similiar versions, since they are statically linked, and can differently support more complex WinAPI calls becouse new version of OS can have adjustements in the .dll file.

    Read the article

  • Dev-C++ and Detours compiling error

    - by Julio
    Hello. As title says I'm trying to compile with Dev-C++ a simple DLL using Detours, but I get this error: syntax error before token '&' on this lines: DetourAttach(&(PVOID &)trueMessageBox, hookedMessageBox) DetourDetach(&(PVOID &)trueMessageBox, hookedMessageBox) The complete code is #include <windows.h> #include <detours.h> #pragma comment( lib, "Ws2_32.lib" ) #pragma comment( lib, "detours.lib" ) #pragma comment( lib, "detoured.lib" ) int (WINAPI * trueMessageBox)(HWND hWnd, LPCSTR lpText, LPCSTR lpCaption, UINT uType) = MessageBox; int WINAPI hookedMessageBox(HWND hWnd, LPCSTR lpText, LPCSTR lpCaption, UINT uType) { LPCSTR lpNewCaption = "You've been hijacked"; int iReturn = trueMessageBox(hWnd, lpText, lpNewCaption, uType); return iReturn; } BOOL WINAPI DllMain( HINSTANCE, DWORD dwReason, LPVOID ) { switch ( dwReason ) { case DLL_PROCESS_ATTACH: DetourTransactionBegin(); DetourUpdateThread( GetCurrentThread() ); DetourAttach(&(PVOID &)trueMessageBox, hookedMessageBox) DetourTransactionCommit(); break; case DLL_PROCESS_DETACH: DetourTransactionBegin(); DetourUpdateThread( GetCurrentThread() ); DetourDetach(&(PVOID &)trueMessageBox, hookedMessageBox) DetourTransactionCommit(); break; } return TRUE; }

    Read the article

  • Is it possible to generate Events and Hooks in Lua for any game without built-in support?

    - by pr0tocol
    Does a game have to have built-in functions to accept and run lua scripts, or can I design Events and Hooks using Lua on any game I please, akin to the days where C code could be used to hook into the WinAPI using dlls? The reason I ask is, I am trying to create a background application that will perform events and hooks on a particular game that does not currently support lua in-game. Brief examples: Events: - An action executed by the PLAYER is detected. For instance, hitting the Q key will normally make my character use an ability, but with my Lua script running in the background, will cause a sound to play on my computer (or something). Hooks: - An action within the GAME is detected. For instance, the game spawns an enemy every minute. When an enemy spawns, the script will detect this and perform an action, for instance playing a sound locally on the computer. I would like to do both, but I know for games like Garry's Mod, the game already has built-in support for running lua scripts. Is there a way to do either events OR hooks using lua similarly to how C/C++ can connect to a game using WinAPI dlls?

    Read the article

  • Importing .dll into Qt

    - by Bad Man
    I want to bring a .dll dependency into my Qt project. So I added this to my .pro file: win32 { LIBS += C:\lib\dependency.lib LIBS += C:\lib\dependency.dll } And then (I don't know if this is the right syntax or not) #include <windows.h> Q_DECL_IMPORT int WINAPI DoSomething(); btw the .dll looks something like this: #include <windows.h> BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) { return TRUE; } extern "C" { int WINAPI DoSomething() { return -1; } }; Getting error: unresolved symbol? Note: I'm not experienced with .dll's outside of .NET's ez pz assembly architechture, definitely a n00b.

    Read the article

  • MS Detours Library, detouring non win api function

    - by flavour404
    Hi, I want to use the windows detours library to detour a non win api function. The function is part of the Qt library (QtGui4.dll). I am wondering how I would set up the function signature for : void QPainter::drawText ( const QPointF & position, const QString & text ) I had a go with this and it received my usual share of errors, a little explanation of requirements would be interesting as well: void (QPainter * real_drawText)(const QPointF & position, const QString & text) = drawText This is what they look like for TextOut, under the windows API: BOOL (WINAPI * Real_TextOut)(HDC a0, int a1, int a2, LPCWSTR a3, int a4) = TextOutW; BOOL WINAPI Mine_TextOut(HDC hdc,int X,int Y,LPCWSTR text,int textLen) { BOOL rv = Real_TextOut(hdc, X, Y, text, textLen); HWND hWindow = WindowFromDC(hdc); SendTextMessage(hWindow, text); return rv; } Thanks.

    Read the article

  • Listening to another window resize events in C#

    - by Steve
    Hi all I am implementing a small application (observer) that needs to "attach" itself to the bottom of another window (observed). The latter is not a window inside the application. At this moment I solved by getting the hWnd of the window and querying periodically in a thread the location of the observed window, moving the observer window accordingly. However this is a very inelegant solution. What I would like to do is to listen to the resize event of the observed window so that the observer will react only when necessary. I assume I should use a hook, and I found plenty of ways of doing it, but my lack of knowledge of the C WinAPI is blocking me in understanding which hook I need to create and how (pinvoke/parameters/etc). I'm pretty sure this is quite trivial, and some of you familiar with C/C++ and WinAPI will have the answer ready at hand ;) Thanks

    Read the article

  • Visual C++ 2008 doesn't recognize Windows declared types

    - by David Thornley
    I have a program that doesn't seem to recognize declared types in the latest U3D software. There's a line typedef BOOL (WINAPI* GMI)(HMON, LPMONITORINFOEX); which gets the error: Error 1 error C2061: syntax error : identifier 'LPMONITORINFOEX' c:\Projects\U3D\Source\RTL\Platform\Common\Win32\IFXOSRender.cpp 28 and a line MONITORINFOEX miMon; which gets Error 5 error C2065: 'miMon' : undeclared identifier c:\Projects\U3D\Source\RTL\Platform\Common\Win32\IFXOSRender.cpp 49 Error 3 error C2065: 'MONITORINFOEX' : undeclared identifier c:\Projects\U3D\Source\RTL\Platform\Common\Win32\IFXOSRender.cpp 49 The program's first non-comment statement is #include <windows.h>, which includes winuser.h, which defines these identifiers. In Visual Studio, I can right-click on them and go to the definition (a typedef) and from the typedef to the struct. WINAPI is defined in WinDef.h, so that seems to be working. There are no redefinitions of LPMONITORINFOEX or MONITORINFOEX in any other file. So, how can this be happening, and what can I do about it?

    Read the article

  • How to immediate send mail without prompt confirmation dialog

    - by lmengyew
    I'm using Delphi XE3 and below is my sample application: unit Unit1; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls; type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private function Send(const FromAddr, ToAddr, Subject: String; const AttachFiles: array of string; const MsgBody: String): boolean; end; var Form1: TForm1; implementation uses Winapi.Mapi; {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); begin Send('', '[email protected]', 'test', [], ''); end; function TForm1.Send(const FromAddr, ToAddr, Subject: String; const AttachFiles: array of string; const MsgBody: String): boolean; var Msg: TMapiMessage; lpSender, lpRecipient: TMapiRecipDesc; Attach: array of TMapiFileDesc; SMTP: TFNMapiSendMail; MAPIModule: HModule; i: integer; S: string; begin Result := False; FillChar(Msg, SizeOf(Msg), 0); Msg.lpszSubject := PAnsiChar(UTF8String(Subject)); Msg.lpszNoteText := PAnsiChar(UTF8String(MsgBody)); if FromAddr <> '' then begin lpSender.ulRecipClass := MAPI_ORIG; lpSender.lpszName := PAnsiChar(UTF8String(FromAddr)); lpSender.lpszAddress := PAnsiChar(UTF8String(FromAddr)); lpSender.ulReserved := 0; lpSender.ulEIDSize := 0; lpSender.lpEntryID := Nil; Msg.lpOriginator := @lpSender; end; if ToAddr <> '' then begin lpRecipient.ulRecipClass := MAPI_TO; lpRecipient.lpszName := PAnsiChar(UTF8String(ToAddr)); lpRecipient.lpszAddress := PAnsiChar(UTF8String(ToAddr)); lpRecipient.ulReserved := 0; lpRecipient.ulEIDSize := 0; lpRecipient.lpEntryID := Nil; Msg.nRecipCount := 1; Msg.lpRecips := @lpRecipient; end; SetLength(Attach, Length(AttachFiles)); FillChar(Attach[0], Length(Attach) * SizeOf(TMapiFileDesc), 0); i := 0; for S in AttachFiles do begin Attach[i].nPosition := Cardinal($FFFFFFFF); Attach[i].lpszPathName := PAnsiChar(UTF8String(S)); Inc(i); end; Msg.nFileCount := Length(AttachFiles); if Msg.nFileCount = 0 then Msg.lpFiles := nil else Msg.lpFiles := @Attach[0]; MAPIModule := LoadLibrary(PChar(MAPIDLL)); if MAPIModule <> 0 then begin try @SMTP := GetProcAddress(MAPIModule, 'MAPISendMail'); if @SMTP <> nil then Result := SMTP(0, Application.Handle, Msg, 0, 0) = SUCCESS_SUCCESS; finally FreeLibrary(MAPIModule); end; end; end; end. When i click the Button1, it will prompt the confirmation dialog as print screen. My question is how to immediate send mail without prompt the confirmation dialog? Is this possible to achieve?

    Read the article

  • Subterranean IL: Pseudo custom attributes

    - by Simon Cooper
    Custom attributes were designed to make the .NET framework extensible; if a .NET language needs to store additional metadata on an item that isn't expressible in IL, then an attribute could be applied to the IL item to represent this metadata. For instance, the C# compiler uses DecimalConstantAttribute and DateTimeConstantAttribute to represent compile-time decimal or datetime constants, which aren't allowed in pure IL, and FixedBufferAttribute to represent fixed struct fields. How attributes are compiled Within a .NET assembly are a series of tables containing all the metadata for items within the assembly; for instance, the TypeDef table stores metadata on all the types in the assembly, and MethodDef does the same for all the methods and constructors. Custom attribute information is stored in the CustomAttribute table, which has references to the IL item the attribute is applied to, the constructor used (which implies the type of attribute applied), and a binary blob representing the arguments and name/value pairs used in the attribute application. For example, the following C# class: [Obsolete("Please use MyClass2", true)] public class MyClass { // ... } corresponds to the following IL class definition: .class public MyClass { .custom instance void [mscorlib]System.ObsoleteAttribute::.ctor(string, bool) = { string('Please use MyClass2' bool(true) } // ... } and results in the following entry in the CustomAttribute table: TypeDef(MyClass) MemberRef(ObsoleteAttribute::.ctor(string, bool)) blob -> {string('Please use MyClass2' bool(true)} However, there are some attributes that don't compile in this way. Pseudo custom attributes Just like there are some concepts in a language that can't be represented in IL, there are some concepts in IL that can't be represented in a language. This is where pseudo custom attributes come into play. The most obvious of these is SerializableAttribute. Although it looks like an attribute, it doesn't compile to a CustomAttribute table entry; it instead sets the serializable bit directly within the TypeDef entry for the type. This flag is fully expressible within IL; this C#: [Serializable] public class MySerializableClass {} compiles to this IL: .class public serializable MySerializableClass {} For those interested, a full list of pseudo custom attributes is available here. For the rest of this post, I'll be concentrating on the ones that deal with P/Invoke. P/Invoke attributes P/Invoke is built right into the CLR at quite a deep level; there are 2 metadata tables within an assembly dedicated solely to p/invoke interop, and many more that affect it. Furthermore, all the attributes used to specify p/invoke methods in C# or VB have their own keywords and syntax within IL. For example, the following C# method declaration: [DllImport("mscorsn.dll", SetLastError = true)] [return: MarshalAs(UnmanagedType.U1)] private static extern bool StrongNameSignatureVerificationEx( [MarshalAs(UnmanagedType.LPWStr)] string wszFilePath, [MarshalAs(UnmanagedType.U1)] bool fForceVerification, [MarshalAs(UnmanagedType.U1)] ref bool pfWasVerified); compiles to the following IL definition: .method private static pinvokeimpl("mscorsn.dll" lasterr winapi) bool marshal(unsigned int8) StrongNameSignatureVerificationEx( string marshal(lpwstr) wszFilePath, bool marshal(unsigned int8) fForceVerification, bool& marshal(unsigned int8) pfWasVerified) cil managed preservesig {} As you can see, all the p/invoke and marshal properties are specified directly in IL, rather than using attributes. And, rather than creating entries in CustomAttribute, a whole bunch of metadata is emitted to represent this information. This single method declaration results in the following metadata being output to the assembly: A MethodDef entry containing basic information on the method Four ParamDef entries for the 3 method parameters and return type An entry in ModuleRef to mscorsn.dll An entry in ImplMap linking ModuleRef and MethodDef, along with the name of the function to import and the pinvoke options (lasterr winapi) Four FieldMarshal entries containing the marshal information for each parameter. Phew! Applying attributes Most of the time, when you apply an attribute to an element, an entry in the CustomAttribute table will be created to represent that application. However, some attributes represent concepts in IL that aren't expressible in the language you're coding in, and can instead result in a single bit change (SerializableAttribute and NonSerializedAttribute), or many extra metadata table entries (the p/invoke attributes) being emitted to the output assembly.

    Read the article

  • Howcome some C++ functions with unspecified linkage build with C linkage?

    - by christoffer
    This is something that makes me fairly perplexed. I have a C++ file that implements a set of functions, and a header file that defines prototypes for them. When building with Visual Studio or MingW-gcc, I get linking errors on two of the functions, and adding an 'extern "C"' qualifier resolved the error. How is this possible? Header file, "some_header.h": // Definition of struct DEMO_GLOBAL_DATA omitted DWORD WINAPI ThreadFunction(LPVOID lpData); void WriteLogString(void *pUserData, const char *pString, unsigned long nStringLen); void CheckValid(DEMO_GLOBAL_DATA *pData); int HandleStart(DEMO_GLOBAL_DATA * pDAta, TCHAR * pLogFileName); void HandleEnd(DEMO_GLOBAL_DATA *pData); C++ file, "some_implementation.cpp" #include "some_header.h" DWORD WINAPI ThreadFunction(LPVOID lpData) { /* omitted */ } void WriteLogString(void *pUserData, const char *pString, unsigned long nStringLen) { /* omitted */ } void CheckValid(DEMO_GLOBAL_DATA *pData) { /* omitted */ } int HandleStart(DEMO_GLOBAL_DATA * pDAta, TCHAR * pLogFileName) { /* omitted */ } void HandleEnd(DEMO_GLOBAL_DATA *pData) { /* omitted */ } The implementations compile without warnings, but when linking with the UI code that calls these, I get a normal error LNK2001: unresolved external symbol "int __cdecl HandleStart(struct _DEMO_GLOBAL_DATA *, wchar_t *) error LNK2001: unresolved external symbol "void __cdecl CheckValid(struct _DEMO_MAIN_GLOBAL_DATA * What really confuses me, now, is that only these two functions (HandleStart and CheckValid) seems to be built with C linkage. Explicitly adding "extern 'C'" declarations for only these two resolved the linking error, and the application builds and runs. Adding "extern 'C'" on some other function, such as HandleEnd, introduces a new linking error, so that one is obviously compiled correctly. The implementation file is never modified in any of this, only the prototypes.

    Read the article

  • Creating Thread in Win32

    - by Dave18
    Does ThreadFunc() gets called two times here? sometimes I notice a single call and sometimes none at all. #include <windows.h> #include <stdio.h> DWORD WINAPI ThreadFunc(LPVOID); int main() { HANDLE hThread; DWORD threadld; hThread = CreateThread(NULL, 0, ThreadFunc, 0, 0, &threadld ); printf("Thread is running\n"); } DWORD WINAPI ThreadFunc(LPVOID p) { printf("In ThreadFunc\n"); return 0; } Output 1 Thread is running In ThreadFunc In ThreadFunc Press any key to continue . . . Output 2 Thread is running In ThreadFunc Press any key to continue . . . Output 3 Thread is running Press any key to continue . . .

    Read the article

  • How to filter http traffic in Wireshark?

    - by par
    I suspect my server has a huge load of http requests from its clients. I want to measure the volume of http traffic. How can I do it with Wireshark? Or probably there is an alternative solution using another tool? This is how a single http request/response traffic looks in Wireshark. The ping is generated by WinAPI funciton ::InternetCheckConnection() Thanks!

    Read the article

< Previous Page | 22 23 24 25 26 27 28 29 30  | Next Page >