|
Hi,
AFAIK there are three ways to go:
1.
make some assumptions on the monitor situation; such as they are next to each other, trying to form one larger desktop. Then some simple arithmetic may get you what you want (kind of: x2 stretches from width1 to width1+width2). But that would fail if they were configured vertically.
2.
use GetSystemMetric() to find the size of the desktop; this is the bounding rectangle of all monitors present, however there could be holes in it, when you have a rectangular arrangement (say 3*2) with some monitor missing, or when the resolutions aren't all the same.
see SM_CXVIRTUALSCREEN and SM_CYVIRTUALSCREEN
3.
use some Win32 function, maybe EnumDisplayDevices(), to find out how many monitors there are, whether they all are part of the desktop, and if so, where they are in the uniform coordinate system.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
modified on Friday, May 21, 2010 9:05 AM
|
|
|
|
|
Hello all,
I've a question regarding login and logoff, Now with the help of WM_WTSSESSION_CHANGE i get notification of login and logoff, But at the same time i need to know who is logged in or logged off, But the problem is the shell is not started yet so i can't tell which user is looged on, Is there any way to do it..
Thanks all
|
|
|
|
|
Noone
|
|
|
|
|
Hello
I am using win32 console in visual stdio 2008, but conio.h and graphics.h and ... header files doesn't work. WHAT SHOULD I DO?
Is there any way to make visual studio 2008 compatible with these header files?
Thanks any one help me.
|
|
|
|
|
Hi,
the header files you mentioned aren't standard C++ or C header files. These files were specifically for DOS programming - that's the crufty 16 bit thing that pretended to be Microsoft's operating system until Windows NT came out. It's not the Windows console that you're programming.
If I recall correctly back in the mists of time Microsoft VC++ last shipped those headers with Visual C++ 1.5, which was released in 1993 or so with maybe patches up to 1997. Borland's compiler used to have conio.h but I haven't used that in about 20 years so I can't comment further.
So you've got three choices...
- the best option is find somone that's implemented the functions in the headers in a library for VC++ and then released them
- implement the functions in the headers yourself. This is going to be tricky for graphics.h as you don't set a graphics mode in a console based application and you'll probably have to get to grips with DirectX or OpenGL to do something equivalent. conio for the most part should be relatively trivial
- look at the functions the program you want to use is using and find equivalents in the Win32 API or a 3rd party library, converting the code that calls them as you go
Sorry to be the bearer of bad news,
Ash
|
|
|
|
|
|
Well blow me down, I thought it had gone yonks ago.
Thanks for that.
Cheers,
Ash
|
|
|
|
|
Hi,
I loaded a bitmap in resource and dispaly on window using Bitblt function. How could I load the jpeg and display it on screen.
|
|
|
|
|
|
See here.
Life is a stage and we are all actors!
|
|
|
|
|
Acually my motive is to create grayed image......from colored jpeg to grayed image.
I searched and I found "Setting JPEG Compression Level".
Can I also use same for color settings.
Am I on correct way?
|
|
|
|
|
I want to draw an arc in open gl implented in visualc++ console application but i donot find any function to draw an arc and join the two arcs.Can any one tell me how to do this???
|
|
|
|
|
See this discussion[^].
Did you already set-up OpenGL correctly ? Because if you are new to OpenGL, I suggest you start with the basis.
|
|
|
|
|
Problem with Activex control property pages. when any of the properties are changed and next property page is clicked using tabs and oncancel button is clicked of the property sheet the properties are saved.
When property page is changed onapply is getting called automatically and DoDataExchange function is gets called and properties gets updated even after oncancel button.
Inorder to avaoi this wht needs to be done.
sreenivas003@yahoo.co.in
|
|
|
|
|
Hello everybody,
I like to draw a small border inside my CEdit. To "highlight" it.
I use already OnEraseBgnd to fill the entire CEdit in another color.
But in OnEraseBgnd I can't draw a small border, because the entire Background will be redrawn.
If I handle OnPaint(), it works, but in this case, I need to redraw the entire control myself (text, background, etc ...)
Is there a function-call to draw the standard-appearance, and after it, I start to draw myself on it?
I tested already to call the Parent OnPaint() ( CEdit::OnPaint() ) but this won't work.
Big thanks for any idea or basic instruction
Greetings
|
|
|
|
|
baerten wrote: I tested already to call the Parent OnPaint() ( CEdit::OnPaint() ) but this won't work.
-elaborate this a bit, please.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Computers are evil, EVIL i tell you!! <
|
|
|
|
|
Thanks for your post.
OnPaint is called in my control to paint/draw on the control.
If I don't handle the WM_PAINT Message, the initial Drawing-Functions are called and the control is
correctly drawn.
If I handle this Message, the control is blank, no drawings on it. I need to draw all myself.
I want to call a function into OnPaint to draw the initial/standard drawings (Background, Text, ...)
and after this, I make some small paintings on it.
Because I don't want to draw the entire CEdit by myself to simply draw 4 lines on it (an extra border in red)
I hope I could explain it better
Thanks
|
|
|
|
|
I'm not sure i completely understand but why don't you just let OnPaint do it's job and afterwards draw your border? E.g. like this:
CMyGreatEdit::OnPaint()
{
__super::OnPaint();
CDC *dc = GetDC();
ReleaseDC(dc);
}
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Computers are evil, EVIL i tell you!! <
|
|
|
|
|
hi friends,
i develop one protocol in MFC...i am using CSocket. main thread is Listen Thread..its ok fine.. in this thread all the client Handler stored in map..another two subthreads is Requestthread and Reponsethread..
Reponse thread sending Data to clients.. and Requestthread want recieve acknowledgement...
i want send and recieve Continuesly existing clients....
i am facing problem childthreads...please any body...ugrent..
|
|
|
|
|
Member 3653751 wrote: i am facing problem childthreads...please any body...ugrent..
Perhaps you could tell us exactly what problem you are facing, we cannot guess.
It's time for a new signature.
|
|
|
|
|
hi friend,
After sending i want wait for acknowledgement(RecieveThread).
Sendthread and recievethread individual Threads...
Example:
1. 10 clients connected to my Communicator....
2. I want to take associated client information(packets) from database i.e 10 or 100 packets
i want sent proper client and wait for acknowledgment.
After receiving acknowledgment i want sent another packet to corresponding client.
3. i want to all the clients like this...
note : Socket Handler stored in Map<clientid,sockethandler>;
UINT RecieveThread(LPVOID pParam)
{
AfxSocketInit();
CSolusServerDlg *Dlg= (CSolusServerDlg*)pParam;
bool bRun = true;
SOCKET * pCurrentHandle;
CSocket pSocket;
char pBuf[4096];
CWinThread * pCurrentThread;
pCurrentThread = AfxGetThread();
pCurrentHandle = &hClinetHandle;
pSocket.Attach(hClinetHandle);
for(int i=0;i<4096;i++)
pBuf[i] = '\0';
int len;
while(bRun)
{
if(pSocket.Receive(pBuf,4096)>0)
{
len = sizeof(pBuf);
for( int i=0; i<len; i++ )
Dlg->ActionScanReceivedByte(pBuf[i]);
}
}
CliThreadList.RemoveAt(CliThreadList.Find(pCurrentThread));
pSocket.ShutDown(2);
pSocket.Close();
CliHandleList.RemoveAt(CliHandleList.Find(pCurrentHandle));
return 0;
}
UINT Sendthread(LPVOID pParam)
{
AfxSocketInit();
CSolusServerDlg *Dlg= (CSolusServerDlg*)pParam;
bool bRun = true;
SOCKET * pCurrentHandle;
CSocket pSocket;
char pBuf[4096];
CWinThread * pCurrentThread;
pCurrentThread = AfxGetThread();
pCurrentHandle = &hClinetHandle;
pSocket.Attach(hClinetHandle);
vecUploadValues AcfManagementData;
for(int i=0;i<4096;i++)
pBuf[i] = '\0';
int len;
FILE *fpUpload;
char date [10];
char time [15];
SYSTEMTIME st;
char* CStrTrim = new char[1024];
unsigned char *l_uca_Buffer;
unsigned char l_uca_ActualData[1024];
unsigned char l_uca_Buffer1[2048];
unsigned char *cConverationBuffer;
CString strTemp;
char cstrTemp[512];
CDBFile objDB;
CSocket *pSocketSent;
while(bRun)
{
for(IteratorMap = mapControllerHandler.begin(); IteratorMap != mapControllerHandler.end() ;IteratorMap++)
{
char strControllerID[10];
char strControllerIID[10];
int ControllerId = (*IteratorMap).first;
sprintf(strControllerID,"%06d ", ControllerId);
memset(strControllerIID,0,sizeof(strControllerIID));
objDB.GetControllerID(strControllerID,strControllerIID);
objDB.GetData(strControllerIID);
AcfManagementData = objDB.GetUploadValues();
pSocketSent = (*IteratorMap).second;
for(int i =0; i < AcfManagementData.size(); i++)
{
fpUpload = fopen("..\\LogFiles/ControllerLogFile.txt","a");
strTemp = AcfManagementData[i].cUploadValueString;
m_gobjDB->SetCommandData(AcfManagementData[i].cVActionValueString);
strcpy(cstrTemp,strTemp);
int len = strlen(cstrTemp);
l_uca_Buffer = (unsigned char*)cstrTemp;
memset( l_uca_ActualData, 0, sizeof( l_uca_ActualData) );
int unsigned iplen = StringtoCSV(l_uca_Buffer,len ,l_uca_ActualData);
(*IteratorMap).second->Send(l_uca_ActualData, iplen, 0 );
GetSystemTime(&st);
sprintf(date,"%d/%d/%d",st.wDay,st.wMonth,st.wYear);
sprintf(time,"%d:%d:%d:%d",st.wHour,st.wMinute,st.wSecond,st.wMilliseconds);
cConverationBuffer = CSVtoString(l_uca_ActualData,iplen);
fprintf(fpUpload,"%s %s| Sent | <%s>\n", date,time,cConverationBuffer);
fclose(fpUpload);
Sleep(1000);
}
}
}
CliThreadList.RemoveAt(CliThreadList.Find(pCurrentThread));
pSocket.ShutDown(2);
pSocket.Close();
CliHandleList.RemoveAt(CliHandleList.Find(pCurrentHandle));
return 0;
}
please help anybody...
|
|
|
|
|
Member 3653751 wrote: please help anybody...
Well you have still not explained what is not working, or giving incorrect results. Also would you please edit the above message and put <pre></pre> tags around your code so it is properly readable.
It's time for a new signature.
|
|
|
|
|
... Stay tuned... Now booting Mystical Powers...
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]
|
|
|
|
|
|
He has to use mystical powers, because you didn't include any information about your problem.
But you replied with more information to Richard.
Please read the "How to ask questions" post at the top of the forum for more instructions on how to ask a good question.
A good question will get better replies.
Good luck with your problems,
Iain.
I have now moved to Sweden for love (awwww).
|
|
|
|