|
Some people even search Google. What say?
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
MPTP wrote: but it is not working with Vista(UAC Enabled).
define: "not working"
Did you get an error? Any return values, etc.,?
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
See also here [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hello All,
When I am executing the following code
SC_HANDLE schSCManager, schService;
TCHAR szPath[MAX_PATH];
GetModuleFileName(NULL, szPath, MAX_PATH);
schSCManager = OpenSCManager(NULL, NULL ,SC_MANAGER_ALL_ACCESS);
if ( schSCManager == NULL )
return false;
schService = CreateService(schSCManager, USER_SERVICE_NAME, USER_SERVICE_NAME,
SERVICE_ALL_ACCESS,SERVICE_WIN32_OWN_PROCESS,SERVICE_DEMAND_START,SERVICE_ERROR_NORMAL, szPath, NULL, NULL, NULL, NULL, NULL);
The
CreateService() is not returning a proper handle. When I used
GetLastError() , its throwing a
ERROR_ACCESS_DENIED error. Please help in solving this issue.
Thanks in advance,
Neelesh K J Jain.
|
|
|
|
|
Are you executing this from an account with administrator access?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Yes, I have the administrator access.
Thanks,
Neelesh K J Jain.
|
|
|
|
|
From the documentation[^]:
ERROR_ACCESS_DENIED | The handle to the SCM database does not have the SC_MANAGER_CREATE_SERVICE access right. |
That implies that when you called OpenSCManager[^], you didn't ask for the SC_MANAGER_CREATE_SERVICE access right.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hello Stuart,
I tried even with SC_MANAGER_CREATE_SERVICE access right, then also I am getting same error code as access denied.
|
|
|
|
|
Neelesh K J Jain wrote: even with
'even with'? That access right (implied by SC_MANAGER_ALL_ACCESS ) is absolutely necessary for creating a service. And you did include it in your call to OpenSCManager , right?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
|
GetModuleFileName(NULL, szPath, MAX_PATH);
CreateService(schSCManager, USER_SERVICE_NAME, USER_SERVICE_NAME, SERVICE_ALL_ACCESS,SERVICE_WIN32_OWN_PROCESS,SERVICE_DEMAND_START,SERVICE_ERROR_NORMAL, szPath, NULL, NULL, NULL, NULL, NULL);
Try register service from another process
|
|
|
|
|
Hi All
Can i get copied Files/Folder Path which is used copied by option "Cut or Send to Option"?Can any one give tips or example?Plz help me
|
|
|
|
|
Do you possibly you need this [^]?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Thanks for reply.
i am try to run it's article but it's showing two error and i havn't idia about that error.
Error is
<pre>>CVTRES : fatal error CVT1100: duplicate resource. type:MANIFEST, name:2, language:0x0409
1>LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt
Plz help me
|
|
|
|
|
If you have troubles with article's code, then the proper place to ask for help is the article's thread.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Plz tell me how can i solve that error?
|
|
|
|
|
I have created one dialog based application with MySQL database. In that database, 9 tables are used. In my dialog there are 3 butons name allocation, de-allocation and ChangeNew and each button has it own specific functions.
Now I want to create a Dll for 3 functions (Allocation, De-Allocation and ChangeNew). First I tried with MFC Extension DLL and it was working fine but it could used only any MFC based application. But I want to used in non MFC based application.
But I dont know how to write DLL with the classes which can be used in Non MFC based applicaion.
Kinldy help me.
|
|
|
|
|
The side effects of having the wizard do everything for you?
Write a regular Win32 DLL. You can use __declspec(dllexport) to export a function from within the DLL. Again, use the wizard to choose a new project->win32->win32 DLL. There are plenty of articles that explains about DLLs here at CP. You can do a search to have a look at them.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
I need to understand, if possible, why actually there is a macro arround __declspec(dllexport), such that it can be translated into a dllexport or dllimport...
I'm seeing this in many occasions but I do'nt knwo it is doing it
Thanks.
Easy Profiler : a compile-time profiler for C++
www.potatosoftware.com
|
|
|
|
|
Ahmed Charfeddine wrote: I need to understand, if possible, why actually there is a macro arround __declspec(dllexport), such that it can be translated into a dllexport or dllimport...
Such macros are usually written to avoid typing __declspec(dllexport) every time. Something like MYEXPORT would do instead. Also, the same macro would be defined as __declspec(dllimport) in the importing side, so I can be just double lazy.
There are several good articles at CP on the DLLs section[^], I recommend you read them.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
AS a side note to Rajesh's reply, you may, as well, use the wizard to obtain a Win32 DLL skeleton: choose Win32 project as the new project and DLL as 'Application type' in the 'Application Settings' tab (at least it works on my VS2005 ).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi,
I have created a new Windows Forms Control Library (Visual C++ -> CLR) in Visual Studio. How do I view this form from an MFC application?
Thanks.
|
|
|
|
|
Does this[^] help? If so, can I point you to the source[^] of all my wisdom.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi There,
I am using the following example to make Win32 tab control without using MFC.
Win32 SDK C Tab Control made easy[^]
There are some business reasons that I can only use Win32 API for this.
I am able to create the tab pages. But finding weird behaviour with the messageloop.
I am making an XLL, so my dialog is opened from a selection from Excel menu item.I get a dialog box with tabs on clicking this certain menu item. Each tab has some edit boxes and buttons. which all work fine except the TAB key doesnt work to move from one item to another.
I have implemented it the same way as in above program. The problem i face are:
1. When i click on the tabs, it shows me the correct child dialog. when i change the selection of tab, it goes to the correct next dialog. so everything works fine here. But when i click on any area in the child dialog (i.e to activate the message loop), The tab key starts working on that particular selected tab, BUT after this i am not able to select any other tab. On clickin on any other tab takes me to the first tab (iSel=0)
2. When I close the dialog box from the X button in top right corner; It closes the dialog box BUT it also closes my Excel window which i dont want.
This application I am developing to configure and test some connections. so I need the excel window open after i am done with the configurations.
Please reply if you read this message. I will appreciate any help.
Regards
Ajay
ajaymat@gmail.com
The code for message loop is here
HACCEL CAuthenticationAddin::CreateAccTable (VOID)
{
static ACCEL aAccel[1];
static HACCEL hAccel;
aAccel[0].fVirt=FVIRTKEY;
aAccel[0].key=VK_ESCAPE;
aAccel[0].cmd=CMD_VK_ESCAPE;
aAccel[1].fVirt=FVIRTKEY;
aAccel[1].key=VK_RETURN;
aAccel[1].cmd=CMD_VK_RETURN;
hAccel=CreateAcceleratorTable(aAccel,1);
return hAccel;
}
void CAuthenticationAddin::TabPageMessageLoop (HWND hwnd)
{
MSG msg;
int status;
BOOL handled = FALSE;
HACCEL hAccTable = CAuthenticationAddin::CreateAccTable();
while((status = GetMessage(&msg, NULL, 0, 0 )) != 0 && !stopTabPageMessageLoop)
{
if (status == -1)
{
return;
}
else
{
handled = TranslateAccelerator(hwnd,hAccTable,&msg);
if(!handled)
handled=IsDialogMessage(hwnd,&msg);
if(!handled)
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
}
if(stopTabPageMessageLoop)
{
DestroyAcceleratorTable(hAccTable);
stopTabPageMessageLoop = FALSE;
return;
}
DestroyAcceleratorTable(hAccTable);
PostQuitMessage(0);
return;
}
VOID CAuthenticationAddin::ResetTabPageMessageLoop (HWND hwnd)
{
stopTabPageMessageLoop=TRUE;
stopTabPageMessageLoop=FALSE;
SetFocus(hwnd);
CAuthenticationAddin::TabPageMessageLoop(hwnd);
}
|
|
|
|
|
Can I suggest you try debugging the XLL? It's just a DLL, so tell it to use Excel as its executable in the project's Debugging properties, set breakpoints on the relevant handlers and off you go.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|