"method" is a function pointer. You should cast it to a function pointer type that is the same as ChangeWindowMessageFilter. Then, instead of calling ChangeWindowMessageFilter(...)
, call method(...)
.
fefe wyx
Posts
-
XP Screensaver and VS2008 -
XP Screensaver and VS2008I think you need to use
LoadLibrary
to load "user32.dll" and userGetProcAddress
to get the function ChangeWindowMessageFilter. -
Virtual ConstructorWell ... What do you think you can do with a virtual constructor?
-
Better error checking using sscanfYou can set a property of the TextBox, allowing only the input of float numbers. Then users can't input letters into the TextBox. Sorry I can't provide the details right now. Or if you are only dealing with float numbers, maybe atof() will help. It will reject any input that is not a valid float.
-
Redirection in command line "<"Note that stdin and stdout are also file handles. When no redirection occurs, stdin is the keyboard and stdout is the monitor. In the form of
program1.exe > out.txt
, stdout is assigned with a file handle to the file out.txt, instead of the monitor. So all the output goes into out.txt instead of the monitor. In the form ofprogram1.exe < in.txt
, stdin is assigned with a file handle to the file in.txt, instead of the keyboard. So whenever you read from stdin, e.g. when you call the scanf() function, the data come form in.txt, not the keyboard. Redirecting is handled by the OS, not by the program, so the program itself will know nothing about the redirection, and redirection directives would be passed to program as parameters. Thus argc in main is 1, not 3. -
Call constructorNo, you can't do that. It will just create a temporary object, but not calling the other constructor on the same object. You can write your initialization code in a separate function, and call the initialization function from each constructor.
-
Convert char string to UTF-8First use MultiByteToWideChar() to convert the char string from your local code page to wide char, then use WideCharToMultiByte() to convert the wide char string to UTF8. You may use CP_ACP for your local code page, and code page for utf-8 is 1200. But I've never tried the conversion between wide char and utf-8, so I'm not sure whether it would succeed.
-
String of integersThe last element of aArray if aArray[3], but not aArray[4]. And what do you mean by:
Herboren wrote:
for ( n=0; n<0; n++ )
-
Library file redefinition errorWell, in that case you may have to recompile the libraries. You may either change the structure names, or put the libraries in different namespaces.
-
Upper limit of rand() functionThere's not such a function.
-
Small questionIf you can access the Internet, you can go to http://msdn.microsoft.com
-
Setting multile line text in a documentYou can use
SetWindowText
. Also you can useReplaceSel
to insert text in the current cursor position if nothing is selected. -
!declared to have 'C' linkageDo you by any chance introduced such code in you project:
extern "C" { //... #include "SOMEHEADER.h" //... }
where SOMEHEADER may be wspiapi.h or any header file that may use wspiapi.h. -
Copy ConstuctorThe parent constructor is called at the beginning of the initialization, but not necessarily the copy constructor. For a default copy constructor, of course the copy constructor of the base would be called. But if the copy constructor is provided in the derived class explicitly, it can be chosen that which one of the base class's constructor is to be called.
-
Implicit constructorsConstant members must be initialized, and reference members bound, *explicitly* in the member initializing list of the constructor. And the behavior of the default copy constructor is to perform a memberwise copy to its sub-objects, which would become impossible is any of the sub-objects have an inaccessible copy constructor.
-
Text file got encoded in UTF16. (VC2005)I'm using Visual Studio Express. I tried to output some data into a text file, I found that the file is encoded in UTF16. The wired part is that non-ASCII characters are in MultiByte encoding (all of them takes two bytes), but the ASCII ones got in UTF16 (which also takes two bytes), and the whole file has a UTF16 BOM. The file is opened with
fopen
, and written withfprintf
. My strings in my program all all unicode strings, so I had to write like this:fprintf(" "); fprintf("%ls", L"UNICODE STRING");
There is some non-ASCII characters in my unicode strings. I used wide-char version functions in my program explictly, except for file operations (I didn't use wfprintf or wfopen). The charset for the project is set to "No set", and neitherUNICODE
norMBCS
is defined. I have set the locale at the begin of main. And I want to get a MultiByte file, how can get it? Thanks in advance. -
get txt file sizeYou may use
fseek()
to go the end of the file, and useftell()
to get file current position, which is now also the file size. -
FindFirstFile returning wildcards?skullfire wrote:
I have to prefix this "\\?\" to the path right?
No. You do not have to add the prefix. Just go to your project settings and change your project to using UNICODE. And you have to change all string constants in your program to wide char strings, i.e.,
"*.*"
should be replaced withL"*.*"
, unless you are using the TEXT macro like:skullfire wrote:
if (strPattern.Right(1) != TEXT("\\") )
-
How to set the backcolor of MS Excel cellsHere's a code segment written in VB
With Selection.Interior .ColorIndex = 3 ' this is red ... .Pattern = xlSolid End With
I think it it easy to know how to do it in VC from that. By the way, there is a way to know how to get some work accomplished in your codes: just open Excel, and record a macro doing just the same thing, then you can check the code in Excel's Macro editor. I got that piece of code in this way.
-
standard Include Directories in Vc++ VS2005The Include path can be check or set in Tools->Options , Projects and Solutions->VC++ Directories