|
I've imported a lot of type libs, but now I like to create an own one. I've searched for artickles here at CP but no success...
any tip where to start?
_____________________________
...and justice for all
APe
|
|
|
|
|
Use MIDL commandline tool!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
::Stupid Question Alert::
Compiling my application with warning level 4, I get a fair number of “warning C4100: (param name here) unreferenced formal parameter”.
Is this something I should concern myself with or just ignore it? It was helpful in catching a couple of variables that where declared but unused.
-------------------------------
|
|
|
|
|
No it's not a problem, just asking you if your function prototype has a mistake in it or not. I think you can get it to keep quiet by doing somthing like this:
void Function(int foo)
{
foo;
}
Joel Holdsworth
Wanna give me a job this summer?
Check out my online CV and project history[^] - now available in MSWord format![^]
|
|
|
|
|
Joel Holdsworth wrote:
I think you can get it to keep quiet by doing somthing like this:
void Function(int foo)<br />
{ <br />
foo;
}
<br />
I had started doing that then thought um that might be bad, let’s see what every one else says. All of the function prototypes that I have created myself are fine. It mostly just the message over rides that cause this problem.
Thanks much Joel
-------------------------------
|
|
|
|
|
Yeah you just rewminded me the other way to deal with the problem (probably more efficiant too) i this.
Say my function has to be have the parameters WPARAM followed by LPARAM, you don't have to give these names:
int Function2(WPARAM, LPARAM param2)
{
param2 += 6;
} You see the WPARAM is still present in the parameter list, but is not referenced at all. I think the optimiser should reduce the two methods to producing the same code, but this way is a little more elegant.
Joel Holdsworth
Wanna give me a job this summer?
Check out my online CV and project history[^] - now available in MSWord format![^]
|
|
|
|
|
Yea that’s how I send messages when I don’t need the first param (WPARAM).
It’s the params from over ridded messages that’s causing the problems.
-------------------------------
|
|
|
|
|
I've used
<br />
void Function(int param1, int param2)<br />
{<br />
UNREFERENCED_PARAMETER(param2);<br />
}<br />
and
<br />
void Function(int param1, int )<br />
{<br />
}<br />
I think there's another macro, can't remember it offhand.
Pssst. You see that little light on your monitor? That's actually a government installed spy camera. Smile and wave to big brother!
|
|
|
|
|
Jack Squirrel wrote:
void Function(int param1, int param2)
{
UNREFERENCED_PARAMETER(param2);
}
I like that one. Pretty clear that, that param is not used.
-------------------------------
|
|
|
|
|
Jack Squirrel wrote:
I think there's another macro, can't remember it offhand.
MFC's macros: "UNUSED" and "UNUSED_ALWAYS" will do that trick for you too
I also got the blogging virus..[^]
|
|
|
|
|
This is the best way thought
void Function(int param1, int /*param2*/)
{
}
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Papa wrote:
void Function(int param1, int /*param2*/)
{
}
Yea know some how I bet your correct.
Anyone else know for sure?
Thx Much
-------------------------------
|
|
|
|
|
The bug slayer, John Robbins, in his Debugging Applications for Microsoft .NET and Microsoft Windows (Great book btw)
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Sounds good.
Now that I’m at home and free to wander the net I found an article at
http://msdn.microsoft.com/msdnmag/issues/05/05/CAtWork/default.aspx[^]
Which comments on this very subject. They say it doesn’t really matter. I’m inclined to think that commenting the section out is a "little" cleaner way to go about it (after some experimentation).
-------------------------------
|
|
|
|
|
I know that these macros often resolve to
param = param;
which is a junk code just to reference the param.
The commenting of the param just instruct the compiler to *not see* the param in order to skip the warning
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Is there a simple way I can find out how much memory (Private Bytes) my app currently has (in code, that is)
--
Help me! I'm turning into a grapefruit!
Buzzwords!
|
|
|
|
|
You can use the performance counters for this. Something like:
TCHAR szAvailBytes[256] = TEXT("");
TCHAR szCacheBytes[256] = TEXT("");
TCHAR szWorkingSet[256] = TEXT("");
TCHAR szBuffer[256] = TEXT("");
DWORD dwBufferSize = sizeof(szAvailBytes);
HCOUNTER hAvailBytes,
hCacheBytes,
hWorkingSet;
HQUERY hQuery = NULL;
PDH_COUNTER_PATH_ELEMENTS pdhCpe;
PDH_STATUS pdhStatus;
PDH_FMT_COUNTERVALUE pdhfmtAvail,
pdhfmtCache,
pdhfmtWorking;
pdhStatus = PdhOpenQuery(NULL, 0, &hQuery);
if (pdhStatus == ERROR_SUCCESS)
{
pdhCpe.szMachineName = TEXT("crow-nt");
pdhCpe.szObjectName = TEXT("Memory");
pdhCpe.szInstanceName = NULL;
pdhCpe.szParentInstance = NULL;
pdhCpe.dwInstanceIndex = -1;
pdhCpe.szCounterName = TEXT("Available Bytes");
pdhStatus = PdhMakeCounterPath(&pdhCpe, szAvailBytes, &dwBufferSize, 0);
pdhCpe.szCounterName = TEXT("Cache Bytes");
dwBufferSize = sizeof(szCacheBytes);
pdhStatus = PdhMakeCounterPath(&pdhCpe, szCacheBytes, &dwBufferSize, 0);
pdhCpe.szObjectName = TEXT("Process");
pdhCpe.szInstanceName = TEXT("_Total");
pdhCpe.szCounterName = TEXT("Working Set");
dwBufferSize = sizeof(szWorkingSet);
pdhStatus = PdhMakeCounterPath(&pdhCpe, szWorkingSet, &dwBufferSize, 0);
pdhStatus = PdhAddCounter(hQuery, szAvailBytes, 0, &hAvailBytes);
pdhStatus = PdhAddCounter(hQuery, szCacheBytes, 0, &hCacheBytes);
pdhStatus = PdhAddCounter(hQuery, szWorkingSet, 0, &hWorkingSet);
pdhStatus = PdhCollectQueryData(hQuery);
pdhStatus = PdhGetFormattedCounterValue(hAvailBytes, PDH_FMT_LONG | PDH_FMT_NOSCALE, NULL, &pdhfmtAvail);
pdhStatus = PdhGetFormattedCounterValue(hCacheBytes, PDH_FMT_LONG | PDH_FMT_NOSCALE, NULL, &pdhfmtCache);
pdhStatus = PdhGetFormattedCounterValue(hWorkingSet, PDH_FMT_LONG | PDH_FMT_NOSCALE, NULL, &pdhfmtWorking);
wsprintf(szBuffer, TEXT("Physical Mem = %ldMB\n"), (pdhfmtAvail.longValue + pdhfmtCache.longValue + pdhfmtWorking.longValue) / (1024 * 1024));
pdhStatus = PdhCloseQuery(hQuery);
}
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
You can open a handle to your process and use VirtualQueryEx to scan the memory usage for your program.
Examine the MEMORY_BASIC_INFORMATION.State and MEMORY_BASIC_INFORMATION.Type to accumulate the totals for the memory information that interests you.
You can make a function to find out how much memory is being used by executable code, how much is free, how much is comitted, how much is in memory mapped files, etc.
|
|
|
|
|
hi all,
well i'm developing a simple packet sniffer using winpcap in VC++ environment.. where packets are captured and filtered.... i'm able to filter using port no,ip address and protocol but what i'm suppose to do is to filter packets using process ID which i'm unable to do..so please any one can help me as soon as possible... thanks in advance
regards
sura
sura
|
|
|
|
|
You could use GetTcpTableEx()/GetUdpTableEx() to get a list of the TCP/UDP connections and their processes. Assuming your app is to run on minimum OS of XP, of course.
Alternativly ud need to develop a low level driver to do that.
|
|
|
|
|
Hi,
Recently i've seeing a lot of articles on DLL injection (injection code into another process or something like that). Can anyone tell em the uses of it and how it works? Just curious!
|
|
|
|
|
It's a very flexible teqnique. It essentially allows yor application to do things which arn't otherwise possible. For example in this project[^] i used code injection to deactivate the Ctrl+Alt+Delete key combo. I've seen code injection used to skin the windows tray clock: http://www.rcis.co.za/dale/tclockex/[^]. In both cases here code has been injected, and setup to hook into the WindowProc so that messages a routed through it to allow the code to extend or surpress standard functionality. The sky's the limit - use your imagination!
Joel Holdsworth
Wanna give me a job this summer?
Check out my online CV and project history[^] - now available in MSWord format![^]
|
|
|
|
|
How to get notified when user logoff?
WM_ENDSESSION & WM_QUERYENDSESSION messages are not OK. Cause the system won't send these messages when EWX_FORCE flag is set in ExitWindowsEx function.
Is there any way to get notified other than using dll in "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\
CurrentVersion\Winlogon\Notify" entry?
Thanks a lot!
Let's roll!
|
|
|
|
|
Check out ISensLogon .
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hi, I have a 11x5 bidimensional array of .net textboxes in my app. When the user paste into one of those textboxes, I want to parse the clipboard string, splitting it in 2length substrings and putting each substring in each textbox. Example:
I copy from a web page this string: "10 11 12 13 14". Then I paste (with mouse or ctrl-v) in the first textbox. I want the first text box take the "10" value, the second one the "11" value etc... etc... There also restrinctions of numbers (they must be >0 and <90 and not repeated for line) but I've already implemented those checks with some keyPress, controlLeave and controlEnter event handlers.
I have no clue wich is the best way to do it. Help.
|
|
|
|