|
write a function ChangeLock() of your object
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
You could have 2 accelerator tables, one for lock and one for unlock assigned to Ctrl+L and swap between them when needed, or if you create the accelerator table programatically using CreateAcceleratorTable[^] then you could re-create the table with the new key-command assignments as needed, but i doubt you want to go thorough this trouble to implement an ugly solution. You are probably better off assigning a third command to Ctrl+L whose handler will toggle/negate the current state as someone already suggested.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
I have an ocx (in visual studio 6, lets call in main ocx) which includes in it a pointer to another ocx (which was written in visual studio 2005, lets call it sub ocx). the main ocx (in Visual Studio 6) has a wrapper for the second ocx which was created by "project->add to project->components and controls", the wrapper is 1 *.cpp file and one *.h file.
In the code in the main ocx, I call "psub = new sub()", and after that I call psub->create(...).
inside create I get crush in file OCCCONT.CPP, at function "BOOL CWnd::InitControlContainer()" at line "m_pCtrlCont = afxOccManager->CreateContainer(this);"
In sub::InitInstance() I call AfxEnableControlContainer() and also in main::InitInstance() I call AfxEnableControlContainer(), as I've read in the internet while I was trying to figure out the problem, but I still get crush.
This is the place to mention that the place where I call "psub = new sub()" and then "psub->create(...)" is inside a static thread. I must keep this call inside the static thread.
In addition, I see that the psub->m_hWnd before psub->create(...) is null.
Does anyone have any idea what to do?
Thanks
Miriam
|
|
|
|
|
you better use the same Version of Visual Studio for all OCX for compatibility.
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
but the sub ocx uses webservice which is supported only in VS 2005, and the rest of the code, (which is huge projects, milions of code-lines) is in VS 6.
Do you have any other idea?
Thanks
|
|
|
|
|
Finding the crash course, looks like you need a HWND and havent a valid one. -> Create a Window.
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
you mean creating a window in the sub ocx or the main one?
or it doesn't matter..
Thanks
modified on Tuesday, December 15, 2009 7:44 AM
|
|
|
|
|
for solving your writing: "I see that the psub->m_hWnd before psub->create(...) is null."
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Hi.
I created a window in the sub ocx and added this method to the wrapper (please remember that the main ocx calls the sub ocx's methods by invoke helper (it is created inside the wrapper)).
now, after i call new sub() and before I call psub->create(...) , I call the new mthod that creates the sub window. When I call that method, the invoke helper crushes in WINOCC.CPP function CWnd::InvokeHelper at line
" ASSERT(m_pCtrlSite != NULL); // not an OLE control (not yet, at least) "
I don't understand why.
I checked the sub ocx and that new function of it and it works fine as stand alone but when I have the wrapper between it, it crushes there (where I mentioned).
I serached in the internet and saw that most of the solutions for this problem is calling DoModal function but the ocx is not dialog based (the wrapper was build ,thought, through dialog based dll and I copied the wrapper into my project).
I would appreciate any help
Thanks
|
|
|
|
|
Hi all...
I have a third party OCX , which i want to use in my application.
Can someone help me out , how to do this.
I have never done any such stuff , but i know VC++ a bit.
Also tried to search on net but no useful help is there.
It'll be really helpful if i can get any help from you guys.
It's not enough to be the best, when you have capability to be great....
|
|
|
|
|
If you're using MFC then, on Visual Studio, select the Project->Add Class menu item and (in the newly appeared window) choose MFC Class From ActiveX Control .
It will allow you to browse for the .OCX file (or select it form the ones in the registry) and finally will generate the MFC wrapper class.
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]
|
|
|
|
|
|
You are welcome.
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 all,
i m inserting number of items in list control,here the vertical scroll bar automatically displayed when items are more than its height.
i want to move vertically down the scroll bar while inserting value,to know what value is inserted now.
please tell me how can i do this.
thanks in advance.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
Hi,
See CListCtrl::EnsureVisible[^]. You should ensure that the last item in the control is visible with this call. And that will automatically scroll down if needed.
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
using EnsureVisible after inserting each item.
//i=item no.
m_List.EnsureVisible(i,FALSE);
but its not scroll down
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
for(int i=0; i<100; i++)
{
m_List.InsertItem();
m_List.EnsureVisible(i, FALSE);
} I've verified that this works. If yours doesn't, show me the entire code (only relevant code).
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
yes i do like this,one more thing that i have done,i m using a modeless dialog box above this,for wait until fill the list.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
I have got a code snippet which is very simple windows service,when i start it manually after creating it by sc command it's taking a lot of time to start, and after a long time it gives me an error message of 1053. Then the service's status becomes starting. but surprising part is the service is actually doing its work on background, although i can't stop this service(I need to restart to stop the service). Here is the code,
#include "stdafx.h"
#include "Test00.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
CWinApp theApp;
using namespace std;
#define SLEEP_TIME 5000
#define LOGFILE "d:\\memstatus.txt"
SERVICE_STATUS ServiceStatus;
SERVICE_STATUS_HANDLE hStatus;
void ServiceMain(int argc, char** argv);
void ControlHandler(DWORD request);
int InitService();
int WriteToLog(char* str)
{
FILE* log;
log = fopen(LOGFILE, "a+");
if (log == NULL)
return -1;
fprintf(log, "%s\n", str);
fclose(log);
return 0;
}
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
int nRetCode = 0;
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
_tprintf(_T("Fatal Error: MFC initialization failed\n"));
nRetCode = 1;
}
else
{
SERVICE_TABLE_ENTRY ServiceTable[2];
ServiceTable[0].lpServiceName = "MemoryStatus";
ServiceTable[0].lpServiceProc = (LPSERVICE_MAIN_FUNCTION)ServiceMain;
ServiceTable[1].lpServiceName = NULL;
ServiceTable[1].lpServiceProc = NULL;
StartServiceCtrlDispatcher(ServiceTable);
}
return nRetCode;
}
void ServiceMain(int argc, char** argv)
{
int error;
ServiceStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS|SERVICE_ALL_ACCESS;
ServiceStatus.dwCurrentState = SERVICE_START_PENDING;
ServiceStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN;
ServiceStatus.dwWin32ExitCode = 0;
ServiceStatus.dwServiceSpecificExitCode = 0;
ServiceStatus.dwCheckPoint = 0;
ServiceStatus.dwWaitHint = 0;
hStatus = RegisterServiceCtrlHandler(
"MemoryStatus",
(LPHANDLER_FUNCTION)ControlHandler);
if (hStatus == (SERVICE_STATUS_HANDLE)0)
{
return;
}
error = InitService();
if (error)
{
ServiceStatus.dwCurrentState = SERVICE_STOPPED;
ServiceStatus.dwWin32ExitCode = -1;
SetServiceStatus(hStatus, &ServiceStatus);
return;
}
ServiceStatus.dwCurrentState = SERVICE_RUNNING;
SetServiceStatus (hStatus, &ServiceStatus);
MEMORYSTATUS memory;
while (ServiceStatus.dwCurrentState == SERVICE_RUNNING)
{
char buffer[16];
GlobalMemoryStatus(&memory);
sprintf(buffer, "%d", memory.dwAvailPhys);
int result = WriteToLog(buffer);
if (result)
{
ServiceStatus.dwCurrentState = SERVICE_STOPPED;
ServiceStatus.dwWin32ExitCode = -1;
SetServiceStatus(hStatus, &ServiceStatus);
return;
}
Sleep(SLEEP_TIME);
}
return;
}
int InitService()
{
int result;
result = WriteToLog("Monitoring started.");
return(result);
}
void ControlHandler(DWORD request)
{
switch(request)
{
case SERVICE_CONTROL_STOP:
WriteToLog("Monitoring stopped.");
ServiceStatus.dwWin32ExitCode = 0;
ServiceStatus.dwCurrentState = SERVICE_STOPPED;
SetServiceStatus (hStatus, &ServiceStatus);
return;
case SERVICE_CONTROL_SHUTDOWN:
WriteToLog("Monitoring stopped.");
ServiceStatus.dwWin32ExitCode = 0;
ServiceStatus.dwCurrentState = SERVICE_STOPPED;
SetServiceStatus (hStatus, &ServiceStatus);
return;
default:
break;
}
SetServiceStatus (hStatus, &ServiceStatus);
return;
}
It would be a great help if someone plz help me regarding this.
|
|
|
|
|
What was the resolution? Is the service control method called in the same thread context as the app? I would suspect not,in which case the app never gets the signal, are we not supposed to use mutexes or other local comms mechanism for sharing data between threads?
I'm only asking because I'm about to create a service myself.
Conrad -
The world waits for you to stick your neck out, it's not easy. But once you actually stand up, you do get noticed.
http://www.plcsimulator.org/
|
|
|
|
|
Hi All
I am working on VC++ 2008.When i am creating a new project then error show.
Microsoft visual studio
The operation could not be completed.No such interface supported.
Plz help me
|
|
|
|
|
MsmVc wrote: Microsoft visual studio
The operation could not be completed.No such interface supported.
Why do you always want someone to babysit you? Can't you just Google something painfully obvious like this?!
See here[^]
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
Thanks for reply...
Sorry for you comment
See first i use google then i ask question.
|
|
|
|
|
i am having an exe.it is able to run in othr pcs when i changed it as static. Nw i want 2 make it as a setup.how i can achieve this.
|
|
|
|
|