|
There's no need to include windows.h when using MFC as the Afx header files do this automatically. All you need to do is define _WIN32_WINNT before any files get included by the preprocessor.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Yes, that's the kind of thing I've been trying ... but it still doesn't seem to work.
I have tracked the problem down to this include statement:
#include "winsvc.h"
If I comment this include out (it comes straight after #include "stdafx.h"), the compiler can resolve QueueUserAPC() (but obviously loads of other code doesn't work then!)
Thanks for all your help so far .....
cheers,
Neil
|
|
|
|
|
Sorry ignore that last message ... that was rubbish
What you said last time is correct. Silly me
cheers,
Neil
|
|
|
|
|
Hi All
I wonder about the reason that after create and use some com pointer ( Smart pointer ) why we must call delete of the current pointer ?
I know that the reason is to save memory - but if we does not delete the pointer the application will be crash.
So some one can tell me why the application will crash in case we did not delete the pointer ??
Thanks for any help.
|
|
|
|
|
|
If you are talking about the COM Smart pointers, then you dont have to call a delete on it and we cant delete a com object as it is CoCreated rather new 'ed.
its distructor will take care of releasing active interaces. Once all active interfaces are released the component class objuect will get released automatically, and once all the component class objects are unloaded, the component itself will get unloaded.
Only thing qe need to do is to call Release() on the COM interface. But if it is a Smart pointer you dont have to do that, smart pointer distructor will take care of this. Thats why its smart pointer.
cheers...milton kb.
|
|
|
|
|
Milton KB wrote: Only thing qe need to do is to call Release() on the COM interface. But if it is a Smart pointer you dont have to do that, smart pointer distructor will take care of this. Thats why its smart pointer.
That depends. If you call CoUninitialize() before the smart pointer goes out of scope and hence, has not yet called Release, then you will get a crash, as the call to Release goes off into "I've unloaded that DLL" land.
A trivial fix is to rescope:
CoInitialize(NULL);
{
CComPtr<ifooble> spFoobleThing;
....
}
CoUninitialize();
Steve S
Developer for hire
|
|
|
|
|
thats correct. It is a common mistake COM developers make by putting CoIntialize and Couninitialize in the same function.
cheers...milton kb
|
|
|
|
|
I came accross this great (http://www.codeproject.com/threads/processes.asp?df=100&forumid=4699&exp=0&select=278675) and was wondering if anyone could show how to also output the window title. Any help would be great thx!
|
|
|
|
|
Maybe you can try enumerating all the top level windows using EnumWindows(). And check if the process id matches (Use GetWindowThreadProcessId() ). With the window handle of the process, call GetWindowText() to get the title.
|
|
|
|
|
See here.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hey everyone,
I've been looking around for a simple regular expressions thing to impliment into my code. However, the only kind I can find are far too advanced for what I need. I started writing it myself and got through any number of question marks with 1 asterisk. I cannot get any farther.
I only need it to beable to understand * and ?. So, something like comp_*_sales_*_?pav would hit something like comp_toyota_sales_inhouse_mpav.
It just needs to return true or false for the match. Any help or guidance would be amazing.
Thanks,
Mike
Gaming at the GuildofBlades.com is the only way to really experiece the level 99 Soul-Sucking Sword!
|
|
|
|
|
|
If you are looking to roll your own solution, when you encounter a * in the pattern, iterate through each successive character in the string-to-match until the character following the * is encountered. For example:
char *pszPattern = "comp_*_sales_*_?pav";
// if x points here ^
char *pszString = "comp_toyota_sales_inhouse_mpav";
// and y points here ^
// advance x one character to the _, and advance y until that character is encountered
When you encounter a ? in the pattern, iterate through one character in the string-to-match. As long as the next character matches the character following the ?, it matches.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Not sure why no-one else has mentioned it yet, but have you looked into the PathMatchSpec(...) function? It sounds like exactly the kind of functionality you are looking for, which is MS-DOS-style wildcard matching...
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
Hi there,
I am trying to use CreateFile to open up a file handle however in some instances it doesnt work. Is there a way to convert a file location string into its exact case-sensitive string?
For example.
lszLogFile = "C:\\TeSt\\TeSt.txt";
HANDLE hLogFile = NULL;
hLogFile = CreateFile(lszLogFile, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
lszLogFile is the actual parameter that works with create file and a handle is created, however if
lszLogFile = "C:\\test\\test.txt";
Then a handle will not be created. Is there a way to find out what the actual Directory string is?
Thanks guys,
Robbie
-- modified at 13:10 Monday 19th June, 2006
Added the extra backslashes, and no that wasnt the problem.
|
|
|
|
|
Sure your problem is case related, not a lack of \ characters?
Steve S
Developer for hire
|
|
|
|
|
capricious_001 wrote: lszLogFile = "C:\\test\test.txt";
Should be:
lszLogFile = "C:\\test<font size=6>\\</font>test.txt";
Maxwell Chen
|
|
|
|
|
|
The gap is too large!
Maxwell Chen
|
|
|
|
|
|
I'm confused too ...
Maxwell Chen
|
|
|
|
|
toxcct wrote: i can't see any difference
Because the OP has been modified.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: toxcct wrote:
i can't see any difference
Because the OP has been modified.
nope David, because i was joking...
check the joke icon ;)
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
|
|
|
|
|
capricious_001 wrote: lszLogFile = "C:\\TeSt\TeSt.txt";
This should be:
lszLogFile = "C:\\TeSt\\TeSt.txt";
capricious_001 wrote: Then a handle will not be created.
Why not? Have you checked the return value of GetLastError() ?
capricious_001 wrote: Is there a way to find out what the actual Directory string is?
It's whatever value you have assigned to lszLogFile .
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|