|
|
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);
}
|
|
|
|
|
never used (WM_user+xxx) for interprocess communication .
essay on interprocess messages
http://www.codeproject.com/dialog/messagemgmt.asp
also, you are not trying service interaction with desktop in terminal session, right..
greatest thing is to do wot others think you cant suhredayan@omniquad.com
messenger :suhredayan@hotmail.com
|
|
|
|
|
I am using TSAPI writing a CTI service prog.
in TSAPI,using function(acsEventNotify) allows an application to request that a message be posted to its application queue when an incoming ACS event available.
when Telephony server's receive queue become non-empty,then it would post a msg(user defined) to application,and after application received this msg ,it will get the msg from receive queue to process.
RetCode_t acsEventNotify
(
ACSHandle_t acsHandle,
HWND hwnd,
UNIT msg,
Boolean notifyAll
);
hwnd: the window which receive notif
msg: user-defined msg to be posted when an incoming event become available.
so in my service,i create a window to receive this msg.but i can't receive any msg.however,when my prog is application,it can run correctly.why
|
|
|
|
|
I search many forums.i think the problem maybe desktop.but servicetype is SERVICE_INTERACTIVE_PROCESS.Then where is err?
apppreciate any help!
|
|
|
|
|
someone can help me how to convert text to wave (don't use sapi of microsoft)???
thanks
Nho'c Ti`
|
|
|
|
|
It's probably affordable to write a web service that sends the text to a call centre in India and takes back an mp3.
Seriously, that's a hell of an ask. If Microsoft provides a speech API, why don't you want to use it ?
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
|