|
|
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.
|
|
|
|
|
|
I see your query is answered.
In addition, DO NOT use SMS language anywhere on this site. Next, this is the C++ forum and you should only ask C/C++/MFC queries here.
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
Rajesh R Subramanian wrote: Next, this is the C++ forum and you should only ask C/C++/MFC queries here.
Are you sure? What about Win32, WinSock, GDI, application design questions... I see a lot of these.
|
|
|
|
|
OK, OK. You win the "nitpick of the week" award.
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
hii,
I am getting "Error Creating bitmap!" in EVC++ 4.0 on Window CE 5.0. I don't where this error came from. I am using
CreateCompatibleBitmap and BitBlt for drawing the screen. I have checked all Error codes , but no luck.
Description of Error :
It’s the SNAP window with the “error creating bitmap” message.
“Snap” is in the blue portion
“Error Creating Bitmap” in gray portion
Thanks and regards,
priyank
|
|
|
|
|
May be you can check if the device/emulator has enough memory to hold newly created bitmap.
You can also use the GetLastError() API to know the exact reason for failure.
|
|
|
|
|
Hello Friends
I m trying to change the color of dialog in win32 based application.So for that I m using
switch(msg)
{
case WM_INITDIALOG:
{
HBRUSH bgcolor = CreateSolidBrush(RGB(255,0,0));
return TRUE;
}
case WM_CTLCOLORDLG:
{
return (LONG)bgcolor;
}
}
Any other IDeas??
Thanks & Regards
Yogesh
|
|
|
|
|
Try making HBRUSH bgcolor; a global variable.
Also set the brush in DC which is received in WPARAM of WM_CTLCOLORDLG message.
|
|
|
|
|
You got that to compile?
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
Perhaps we're missing something...
Steve
|
|
|
|
|
A reasonable description of the problem maybe?
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
Hi,
I am trying to wait until the busy cursor of the mouse. I am not understanding how to get the state of the mouse cursor.
Actually i am writing a vbscript to automate a procedure. In which i have to wait for a task to complete, during which the mouse cursor shows the hourglass. Now i want to wait till the mouse cursor doesnot show the hourglass.
Anybody there who cpuld help..
Any help will do.
Thanks in advance for any help
|
|
|
|