|
Stack problem? I thought the OS took care of it unless you specify in thread create func. Thanks.
|
|
|
|
|
Actually I don't have that many threads. Which confuses me.
|
|
|
|
|
Hi,
Can we hide the menu options, if yes please tell me how?
I don't want to disable them, just want to hide under some circumstances and show up later.
Thanks.
|
|
|
|
|
Hi!
I've been trying to figure this bug out for a week, w/out any progress, so I'd like to ask for you help, maybe there's a well-known workaround.
I have an UDP listen socket, which is to accept incoming data from the INET. The problem arises when I try to do this behind ZoneAlarm( so far I've tried this fwall ). I allow every actions (act as a server even for Inet), but when I switch it on, my socket does not receive a single byte of data, although it works properly w/out firewall.
I've also given it a try with the original MFC CAsyncSocket UDP sample, and viola, it worked, even behind firewall. So I started to compare the two codes, but it turned out that they were exactly the same (the networking part of course). I've also checked the ZA settings and they are exactly the same too.
I create the socket w/ almost the default values:
just
<br />
CAsyncSocketDerivedClass sock;<br />
sock.Create( 0, SOCK_DGRAM );<br />
with this code it gets data without ZA but don't get a single byte behind ZA.
Please, heeelp! Thanks in advance!
|
|
|
|
|
Hello *,
I am a very beginner of graphics applications. No experience at all.
I started to develop such as application in VC++ 6 and I have, let's say, a design problem.
The user should draw a lot of different shapes who fit a grid with 4 different scales. The user can perform a series of operation onto these shapes like: moving, attach it to other shape, removing it and so on.
My problem is: what is more efficient, optimized, profi , ... to use: bitmaps or shapes (this is, if I need a rectangle, I use a bitmap which represents a rectangle or I use CDC::Rectangle(...)).
Thx in advance!
Adrian
|
|
|
|
|
Hello all,
I am trying to implement a HTTP client using MFC. I don't want to open the response the page in browser. The program will send a request to the server specifying the URL. When the server responds, that page should get downloaded. I want to save that page as .htm file in a pre-decided folder.
I have seen some books which tell how to open and display the response page in the browser. But I don't want that. I simply want to download the file and save it.
Being a new programmer, I don't know how to do it. If someone could throw some light on this, it will be really very helpful.
Thanks and regards
Madhavi
|
|
|
|
|
|
use
CInternetSession::GetHttpConnection()
and CHttpConnection object
greatest thing is to do wot others think you cant suhredayan@omniquad.com
messenger :suhredayan@hotmail.com
|
|
|
|
|
A week or so ago, I posted a request for help with scrolling large documents - I was hitting the 16 bit limit imposed within SetScrollSizes() and could not scroll to the end of the document. As a reply, I was pointed to look at SCROLLINFO. I have used this in addition to SetScrollSizes() and this initially seemed to solve my problem. It was a short time later that I noticed "a hole" in the window view after scrolling a good way down. I have been disecting my code ad-nauseum without understanding what the problem was. Eventually, I was driven to create a minimal test app to see if the problem was reproduced. It purely prints the line number from 1 to 2155 on consecutive lines. Everything is fine as you scroll down, but when you get to line 2048 (the 32768 pel boundary) a block of blank lines start appearing. Continuing to scroll down, line numbers appear again at either 2056 if scrolling by page, or 2093 if scrolling by line. Scrolling up produces different boundaries, but normal operation does occur at line 2048. (Some of the lines missing in the scroll down "appear" when scrolling up, by the way !!
My OnSize() function for the test app is as below:-
void CTestView::OnSize(UINT nType, int cx, int cy)
{
CScrollView::OnSize(nType, cx, cy);
// TODO: Add your message handler code here
TEXTMETRIC tm;
CDC *pDC = this->GetDC();
pDC->GetTextMetrics( &tm);
m_sizeChar.cy = tm.tmHeight;
m_sizeChar.cx = tm.tmAveCharWidth;
m_sizeClient.cx = cx;
m_sizeClient.cy = cy;
m_sizeDoc.cx = 1024;
m_sizeDoc.cy = 2155 * m_sizeChar.cy;
CSize sizeLine(1,1);
SetScrollSizes(MM_TEXT, m_sizeDoc, m_sizeClient,sizeLine);
// Following code gets over 16 bit restrictions encountered in SetScrollSizes()
SCROLLINFO info;
BOOL rc;
rc = GetScrollInfo(SB_VERT, &info, SIF_PAGE|SIF_RANGE);
if(!rc)
AfxMessageBox("GetScrollInfo() failed");
info.fMask = SIF_PAGE|SIF_RANGE;
info.nMin = 0;
info.nPage = m_sizeClient.cy;
info.nMax = m_sizeDoc.cy - 1;
rc = SetScrollInfo(SB_VERT, &info, TRUE);
if(!rc)
AfxMessageBox("SetScrollInfo() failed");
}
It's obvious that I'm hitting ANOTHER 16-bit "problem", but I can't see where it is.
Can some kind soul point me in the right direction ! ? Many thanks in advance !
Doug
|
|
|
|
|
Maybe this article will be of help
http://www.codeguru.com/Cpp/W-D/doc_view/scrolling/article.php/c3299/[^]
Roger Allen - Sonork 100.10016
Strong Sad:
Clever I am? Next to no one.
Undiscovered and soggy.
Look up. Look down. They're around.
Probably laughing. Still, bright, watery.
Listed among the top. Ten.
Nine. Late night. Early morn.
Early mourn. Now I sleep.
|
|
|
|
|
Can anyone pls tell me how to implement a timeout function in C++??
thx very much
|
|
|
|
|
What do you mean with timeout ? What kinod of application : Win32, MFC, or simple C++ project with standard libs ?
~RaGE();
|
|
|
|
|
maybe a simple C++ project~
can you pls help?? thx very much
|
|
|
|
|
You want something like this?
#include <iostream>
#include <conio.h>
#include <ctime>
using namespace std;
time_t g_Time = 0;
unsigned int g_uInterval;
void SetTimeout(unsigned int uX)
{
g_uInterval = uX;
}
void Begin()
{
g_Time = time(0);
}
bool IsTimeout()
{
if( g_uInterval < difftime(time(0), g_Time) )
return true;
return false;
}
void main()
{
unsigned int uX = 20;
cout << "Press any key in " << uX << " sec.\n";
SetTimeout(20);
Begin();
while(1)
{
if(_kbhit()) {
cout << "Key pressed.\n";
break;
}
if(IsTimeout()) {
cout << "Time out.\n";
return;
}
}
getch();
}
Maxwell Chen
|
|
|
|
|
I need to have a window and a frame inside it.When you push the button,the program must read info from an array,and draw on the frame a black pixel or a white pixel,depending on the value of the current position of the array.That operation will continue until the frame is full with black and white pixels from the whole array.
I don't know how to write the code for that image,and I've been looking lots of info about MFC,but is my first program with MFC.
|
|
|
|
|
I’m geting a runtime-error when calling:
m_myDialog.Create( IDD_RECOURCEDIALOG, this );
in my ActiveX Ctrl OnCreate(..)-method
"m_myDialog" is an Dialoge-recource which I have as a private member of my ActiveX-Ctrl-class
Tanks - Anders
...and justice for all
APe
|
|
|
|
|
How much voltage is required to operate a seven segment LED
keep it up
|
|
|
|
|
Wrong forum, you need to post this in Electronics >Power Requirements >Segment LEDs, this is the Visual C++ forum
|
|
|
|
|
Read the spcification of the LED if you have the NO. Else assume 5 volts.
MSN Messenger.
prakashnadar@msn.com
"If history isn't good, just burn it." - Sidhuism.
|
|
|
|
|
I am in the trouble of convert a jpeg file into bmp file ,
it will be appreciated for some one who can help me .
(source code without using the lib etc will be better.)
|
|
|
|
|
|
Thank you but the link has lost!
you sure the address is right?
|
|
|
|
|
Um, That definately was working when I posted the message. Perhaps the site is having problems at present.
I am not sure where the site is hosted but in Manchester UK there was a fire recently that took out many phone lines and sites. They are still reparing the damage.
Give it a while and try again later. It's definately worth a look at.
Ant.
|
|
|
|
|
Thank you for your advice.I'll try later.Maybe something is wrong with the network.I'm in China.
|
|
|
|
|
I wrote a Service prog and create a window in this service to receive remote program's user defined(WM_user+2330) message.but everything is fine except the window cann't receive message.
anyway,my servicetype is SERVICE_INTERACTIVE_PROCESS,why?
thanks a lot!
class CTsapiWnd : public CWnd
{
public:
.......................
void DoCreate()
{ CreateEx(0, AfxRegisterWndClass(CS_GLOBALCLASS), "",0,0,0,0, 0, 0, 0, 0);}
.........................
}
CTsapiWnd * m_TsapiWndPtr;
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
int nRetCode = 0;
ee=1;
m_TsapiWndPtr=NULL;
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
// TODO: change error code to suit your needs
cerr << _T("Fatal Error: MFC initialization failed") << endl;
nRetCode = 1;
}
else
{
SERVICE_TABLE_ENTRY DispatchTable[] =
{
{ ServiceName, ServiceMain},
{ NULL, NULL }
};
StartServiceCtrlDispatcher(DispatchTable);
}
return nRetCode;
}
void WINAPI ServiceMain(DWORD argc, LPTSTR argv[])
{
hSStat = RegisterServiceCtrlHandler( ServiceName, ServerCtrlHandler);
if (hSStat == 0)
LogEvent (_T("Cannot register control handler"), 100, TRUE);
LogEvent (_T("Control handler registered successfully"), 0, FALSE);
HDESK hdeskCurrent;
HDESK hdesk;
HWINSTA hwinstaCurrent;
HWINSTA hwinsta;
hwinstaCurrent = GetProcessWindowStation();
if (hwinstaCurrent == NULL)
{
LogEvent(_T("get window station err"),0,FALSE);
}
hdeskCurrent = GetThreadDesktop(GetCurrentThreadId());
if (hdeskCurrent == NULL){
LogEvent(_T("get window desktop err"),0,FALSE);
}
hwinsta = OpenWindowStation("winsta0", FALSE,
WINSTA_ACCESSCLIPBOARD |
WINSTA_ACCESSGLOBALATOMS |
WINSTA_CREATEDESKTOP |
WINSTA_ENUMDESKTOPS |
WINSTA_ENUMERATE |
WINSTA_EXITWINDOWS |
WINSTA_READATTRIBUTES |
WINSTA_READSCREEN |
WINSTA_WRITEATTRIBUTES);
if (hwinsta == NULL)
{
LogEvent(_T("open window station err"),0,FALSE);
}
if (!SetProcessWindowStation(hwinsta))
{
LogEvent(_T("Set window station err"),0,FALSE);
}
hdesk = OpenDesktop("default", 0, FALSE,
DESKTOP_CREATEMENU |
DESKTOP_CREATEWINDOW |
DESKTOP_ENUMERATE |
DESKTOP_HOOKCONTROL |
DESKTOP_JOURNALPLAYBACK |
DESKTOP_JOURNALRECORD |
DESKTOP_READOBJECTS |
DESKTOP_SWITCHDESKTOP |
DESKTOP_WRITEOBJECTS);
if (hdesk == NULL)
{
LogEvent(_T("Open desktop err"),0,FALSE);
}
if (!SetThreadDesktop(hdesk))
{
LogEvent(_T("Set ThreadDesktop err"),0,FALSE);
}
SetStatus(hSStat, SERVICE_START_PENDING);
m_TsapiWndPtr=new CTsapiWnd;
m_TsapiWndPtr->DoCreate();
Sleep(1000);
..............................................
setStatus(hSStat, SERVICE_RUNNING);
LogEvent(_T("SERVICE_RUNNING"),0,FALSE);
while(ee)
{
Sleep(1000);
}
SetStatus(hSStat, SERVICE_STOPPED);
LogEvent (_T"SERVICE_STOP"), 0, FALSE);
}
|
|
|
|
|