what type of project u r using?
Milton Karimbekallil
Posts
-
MessageBoxW and converting to LPCWSTR -
Getting Icon information from which application is runyou can resolve an icon information using the
IShellLink
interface methods:Resolve(), GetPath(), GetDescription()
etc. For this u need to pass the sortcut path. But for resolving it on icon click, u may need to write a mouse hook dll or a shell extension. cheers..milton kb. -
callback in windows serviceYes u can use
SERVICE_INTERFACTIVE_PROCESS
in ur CreateService call. cheers..Milton KB -
MFC (database) please help !It looks ur hardware is more than enough and it should not take that much time. So issue is in ur CNote. its better u change that code with ADO or try whatever google link kakan mentioned. cheers..Milton KB
-
callback in windows serviceI had understood what exactly u meant. Ur windows hook is not working in a service app while it works fine in a desktop application. This is what I understood before and now as well. The answer is same as before. Hope you are aware of the fact that the Desktop window is the parent window of all other windows we create using
Createwindow()
API. Actually this desktop what we are seeing is just one among a number of other desktops which Windows OS keeps invisible(some of them are visible as well. eg: logon desktop). This is a mystery to most of us. Actually there is something called a window station and a window station can have n number of desktops in it. A window station is a secure kernel object that contains a clipboard, a private atom table, a set of desktops, and a set of windows. see the info http://www.pluralsight.com/wiki/default.aspx/Keith.GuideBook/WhatIsAWindowStation.html[^] All our applications (including your desktop application what you were talking about) are running under a desktop calledWinsta0\default
. But NT Services are running in a different window station and desktop calledService0x0-3e7$\default
. Your hook will not get invoked as there are no windows in the service desktop. So try by changing the service type toSERVICE_INTERACTIVE_PROCESS
so that the service will run under Winsta0\default desktop and you will start getting the notifications in the windows hook. cheers Milton KB -
callback in windows serviceNt services are running in a difrent window station and desktop called -
Service0x0-3e7$\default
. All our applications are underWinsta0\default
. So there may not be any applications running with an associated window object to invoke the hooked WindoProc. Try by changing the service type toSERVICE_INTERACTIVE_PROCESS
so that the service will run underWinsta0\default
desktop. cheers...Milton KB -
MFC (database) please help !It looks really weird. What is the hardware configuration of the machine where it took 10 minutes to load this 1000 or 1500 records? Comment out the data access code and insert the same number of hard coded strings in a loop into the ListCtrls. Check what the time for this is. If it takes less time, then we can confirm that the issue is with db access, may be indexing is missing. Try this and see what the result is. cheers..Milton KB
-
Using COM component in Java applicationJava provides JNI - java native interface. this is the only way to communicate between Java - Win32 paltfoprms. But JNI needs win32 components as pure win32 dlls and it doesnt understand COM components. So write a win32 dll wrpper over the com component and use it. cheers..Milton KB
-
Fax Routing, Please HelpThis is a C++/CLI forum. Below given forums are more appropriate for these kind of questions. http://www.codeproject.com/script/comments/forums.asp?forumid=186301[^] or http://www.codeproject.com/script/comments/forums.asp?forumid=1644[^] Check whether the modem is installed properly in XP. This can be verified under "Device Manager". cheers..Milton KB
-
gSOAP problem, who know this error message?could u be more specific? what code caused this issue? XMLHTTP? Cheers Milton KB
-
How to use WndProc or WindowsProc functionGuess u forgot the fact that C++/CLI
^
pointer operator and the tracking reference operator%
are not equivalent to its native like counterpart operators*
pointer and the&
reference. Actually ^ is a handle to its managed heap object and its not a pointer to that. But the handle can provide us with the underlying pointer just like we did. cheers..Milton KB -
Limiting an application to single instance...problem? [modified]There are no direct APIs or functions to identify which is second instance or third instance and so on. Why do u need second instance? What exactly is the problem u r facing? If something is crashing in the
ExistInstance
in the second time, you have to find out which statement is crashing. It may be because, u r trying to access an un initialized variable there which may get initialized in the first instance asInitInstance
will execute completely in the first instance. But in the second instance you may bypass those initializations and exits after the 'previous instance' checking. Then when control reachesExitInstance
it will crash as what ever u r accessing is not initialized. Just a thought. chk it out. Cheers..Milton KB. -
How can i design, To calculate's the objects in a classU r looking for objects in a class or objects of a class? If it is the later, ie how to track the the number of objects created for a class, u can use below demo.
class InstanceCntDemo{ private : static int nCnt; public: InstanceCntDemo(){ nCnt++; } static int GetCnt() { return nCnt; } }; int InstanceCntDemo::nCnt =0; int main(){ InstanceCntDemo ic; InstanceCntDemo ic1; InstanceCntDemo ic2; InstanceCntDemo ic3; int nCnt = InstanceCntDemo::GetCnt(); };
Does this make sense? Cheers MiltonKB. -
Multicolumn CListCtrl & custom DrawItemUse the
GetColumn(), GetSubItemRect() and GetItemRect()
methods to navigate to the subitems. See this sample for more details http://www.codeproject.com/listctrl/SubItemSel.asp[^] cheers..Milton KB -
Access to other computer. How to?Hope what u need is to access the file system on the remote computer. For this u have to impersonate the user context of ur application to a user who has acceess on the remote machine. So by using the username and password u have, call
LogonUser
API. Then callImpersonateLoggedOnUser
by passing the tocken u received as out from LogonUser. Once impersonataed, eitehr u can use the unc path to access the remote file system, or if it not shared u can use the default NT share c$, d$ etc for each drive. cheers Milton KB -
How to invoke a command in a context menu?If the API doesn'tprovide such a functionality, then it is impossible for a user code to inject into another applications binary ( though it is possible to some extent through api hooking and ijecting code, its not that practical). cheers...milton Kb
-
Commandu can use Sql DMO for backing up sql server db. its a time consuming process which varies depends on the size of the db to be copied. so its better to make the backup once and ync the backup with changes in the actual db in realtime. cheers ..Milton KB
-
How to use WndProc or WindowsProc functiontry
PDEV_BROADCAST_HDR lpdb = (PDEV_BROADCAST_HDR)(m.LParam.ToPointer());
cheers..Milton KB. -
How to use WndProc or WindowsProc functionNo need to go for WindowPrc as this is an additional work. Becase its already available as part of the framework class library. Given below is a working sample on VS2005. Copy this code in to the .h file of your Form.
virtual void WndProc( Message% m ) override { // Listen for operating system messages. switch ( m.Msg ) { case WM_ACTIVATEAPP: this->Invalidate(); break; } Form::WndProc( m ); }
you have to include windows.h for WM_ACTIVATEAPP to work. cheers..Milton Kb. -
Message Map from non ui applicationThis is possible. Hope ur ServiceMain is in a separate thread. u can use PostThreadMessage to post any message. Then in a loop you can chk for the messages by calling GetMessage or PeekMessage. cheers.. Milton KB