|
You don't poll to get those notifications, they arrive in the message queue like any other messages.
|
|
|
|
|
The problem is that I can't listen to the message pipe. I need a single method cal to guery OS "is there a shutdown pending or not". That's the situation. Any ideas?
|
|
|
|
|
Big problem,
Is it possible to upload files to www.something.com if I have the username and password? I need to send files from my program to our web server. Please help me. Thanks!
|
|
|
|
|
|
can any can say the solution for this
Unhandled exception 0xC0000005: Access violation reading location.
|
|
|
|
|
u are allocating undersize memory to buffer
|
|
|
|
|
Not necessarily...
The OP has code which is trying to access memory that isn't allocated at all, or is trying to write to memory that is read-only - note that this is not hardware related, it's a memory management thing.
Things to do:
use the 'debug' command to run the app and find out where the bad code is.
look for pointers that are being used, but not being initialised/set correctly.
For example,
LPTSTR text = NULL;
or just
LPTSTR text;
The compiler won't flag the first case with 'used but not initialised', but it would generate an AV error (deliberately).
Steve S
Developer for hire
|
|
|
|
|
how can i add CStrings in fetch because it supports only long* ?
Bravoone
|
|
|
|
|
Flaviu_2006 wrote: how can i add CStrings in fetch because it supports only long* ?
Can you give some more details on your problem?
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
I dont understand ur question??
akt
|
|
|
|
|
Could you be more specific
|
|
|
|
|
// Field/Param Data
// field data members
long* m_rgID;
LPSTR m_rgName;
// pointers for the lengths
// of the field data
long* m_rgIDLengths;
long* m_rgNameLengths;
// input parameter data member
CString m_strNameParam;
void MultiRowSet::DoBulkFieldExchange( CFieldExchange* pFX )
{
// call the Bulk RFX functions
// for field data members
pFX->SetFieldType( CFieldExchange::outputColumn );
RFX_Long_Bulk( pFX, _T( "[colRecID]" ),
&m_rgID, &m_rgIDLengths );
RFX_Text_Bulk( pFX, _T( "[colName]" ),
&m_rgName, &m_rgNameLengths, 30 );
// call the RFX functions for
// for parameter data members
pFX->SetFieldType( CFieldExchange::inputParam );
RFX_Text( pFX, "NameParam", m_strNameParam );
}
And i want to add CStrings because my field data are :
CString m_listare;
CString m_carte;
how to do this with CStrings ?
RFX_Long_Bulk( pFX, _T( "[colRecID]" ),
&m_rgID, &m_rgIDLengths );
RFX_Text_Bulk( pFX, _T( "[colName]" ),
&m_rgName, &m_rgNameLengths, 30 );
Bravoone
|
|
|
|
|
CString m_listare;
CString m_carte;
CString csTemp = m_listare + m_carte; // Add two CStrings
Akt_4_U
|
|
|
|
|
you dont understand CString is not suported(error cannot convert from CString to long*)
Bravoone
|
|
|
|
|
Flaviu_2006 wrote: how can i add...
To what? How about explaining exactly what it is that you are wanting to accomplish.
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi
i create a console application using .Net2003.But to use it in c# i have to craete a dll file.Thats why i have to compile my program in .Net class library.But during compilation 3 errors are occur:
1.DBX error LNK2020: unresolved token (0A000018) _CxxThrowException
2.DBX error LNK2020: unresolved token (0A00001A) delete
3.DBX fatal error LNK1120: 2 unresolved externals
if i remove iostream header and namespace std and related function then it will not produce any error.
Plz send me suggestion how to resolve this problem
Parshant
|
|
|
|
|
Hi
i create a console application using .Net2003.But to use it in c# i have to craete a dll file.Thats why i have to compile my program in .Net class library.But during compilation 3 errors are occur:
1.DBX error LNK2020: unresolved token (0A000018) _CxxThrowException
2.DBX error LNK2020: unresolved token (0A00001A) delete
3.DBX fatal error LNK1120: 2 unresolved externals
if i remove iostream header and namespace std and related function then it will not produce any error.
Plz send me suggestion how to resolve this problem
Parshant
|
|
|
|
|
See here[^] maybe it is some helpful to you
|
|
|
|
|
I have created a multithreaded server application in Windows service. In the ServiceMain() function, a listening socket is created to listen for incoming client request. Upon acceptiong a new client request, a new thread will be created to handle that request. The client request is handled by the CMyThread class (parent class is CWinThread), but for debugging purpose, there is no specific implementation in the class yet. I observed that, the service application memory usage keeps on increasing against time. Each new client request will result in about 4K increase in application memory usage after the CMyThread servicing thread terminates. I am not quite sure how the AfxBeginThread() allocates memory in heap and how the CWinThread releases all used resources back to heap. During source debugging, I observed that the CMyThread object was deleted after the ExitInstance() was called.
The service application works well when no thread is created upon receiving new client request. Appreciate if someone can give me a hand on this. Thanks.
Below are snippets of the codes:
// service main function
void CMyService::ServiceMain(DWORD /*dwArgc*/, LPTSTR* /*lpszArgv*/)
{
:
:
CAsyncSocket socListen;
if (!socListen.Create(8080))
{
QuitService(strMsg);
return;
}
if (!socListen.Listen(200))
{
QuitService(strMsg);
return;
}
:
:
CSocket soc;
CMyThread* pThread;
while(!m_bStop)
{
if (socListen.Accept(soc))
{
pThread = (CMyThread*)AfxBeginThread(RUNTIME_CLASS(CMyThread), THREAD_PRIORITY_NORMAL, 0, CREATE_SUSPENDED);
if (!pThread)
{
soc.Close();
strMsg.Format(_T("Failed to create serving thread. Error: %s."), GetLastErrorText(GetLastError()));
AfxGetService()->m_EventLogSource.Report(EVENTLOG_ERROR_TYPE, CS_MSG_SERVICE_ERROR, strMsg);
return;
}
// Pass the socket to the thread by passing the socket handle.
pThread->m_hSocket = soc.Detach();
// start the thread.
pThread->ResumeThread();
}
Sleep(1000);
}
:
:
}
// CMyThread class: MyThread.h
class CMyThread : public CWinThread
{
DECLARE_DYNCREATE(CMyThread)
protected:
CMyThread(); // protected constructor used by dynamic creation
virtual ~CMyThread();
public:
// Used to pass the socket handle from the main thread to this thread.
SOCKET m_hSocket;
// CSocket derived class that handles the connection.
CSock m_socket;
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMyThread)
public:
virtual BOOL InitInstance();
virtual int ExitInstance();
virtual int Run();
//}}AFX_VIRTUAL
};
// CMyThread class: MyThread.cpp
#include "MyThread.h"
IMPLEMENT_DYNCREATE(CMyThread, CWinThread)
CMyThread::CMyThread()
{
m_bAutoDelete = TRUE;
}
CMyThread::~CMyThread()
{
}
BOOL CMyThread::InitInstance()
{
:
:
// Attach the socket handle to a CSocket object.
m_socket.Attach(m_hSocket);
m_socket.m_pThread = this;
:
:
return TRUE;
}
int CMyThread::ExitInstance()
{
m_socket.ShutDown();
m_socket.Close();
:
:
return CWinThread::ExitInstance();
}
int CMyThread::Run()
{
// TODO: Add your specialized code here and/or call the base class
PostQuitMessage(0);
return CWinThread::Run();
}
|
|
|
|
|
Well, to be honest, i didn't read your code, it's too much. But here's a general hint. It's usually better in Server-Applications that serve many Clients, especially when the maximum number if concurrent clientrequests is high or unknown, to use a thread-pool. That means, on Startup you create a certain number of threads, say 10, in suspended mode. Each time a request comes in, you check if there is a free thread, and if so let that thread handle the request. If all threads are busy, you have queue further requests. Good thing about that is, that on suddenly growing number of requests your server memory requirements don't explode. Also, you don't have the performance overhead of all the thread creation/deletion. I can't give you any more specific advise, but i hope it helps.
|
|
|
|
|
Well, to be honest, i didn't read your code, it's too much. But here's a general hint. It's usually better in Server-Applications that serve many Clients, especially when the maximum number if concurrent clientrequests is high or unknown, to use a thread-pool. That means, on Startup you create a certain number of threads, say 10, in suspended mode. Each time a request comes in, you check if there is a free thread, and if so let that thread handle the request. If all threads are busy, you have to queue further requests. Good thing about that is, that on suddenly growing number of requests your server memory requirements don't explode. Also, you don't have the performance overhead of all the thread creation/deletion. I can't give you any more specific advise, but i hope it helps.
Edit: So that's why they allways say : "Only klick that button once !" ...
|
|
|
|
|
Hi,
I need to pop a small window from below when I move my mouse to a bimap placed below the window and it should disappear once I click on the client area. Iam lack of thoughts .Any suggestions or links would be appreciated.
Thanx in Advance.
Today is a gift, that's why it is called the present
|
|
|
|
|
narayanagvs wrote: pop a small window from below
HWND hWnd=CreateWindow("STATIC","MyWindow",WS_CHILD|WS_VISIBLE|WS_BORDER|WS_POPUPWINDOW ,0,0,0,0,m_hWnd,NULL,GetModuleHandle(NULL),NULL);
for (int i=0;i<100;i++)
{
Sleep(1);
::SetWindowPos (hWnd,NULL,0,0,100,i,SWP_SHOWWINDOW);
}
// This would only be one of the options.
/// You can also try and create a pop up style Menu and use it.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Is there any way to subclass a messagebox, I want to add a hyper link in it.
|
|
|
|
|
LiYS wrote: subclass a messagebox
Hook the message box from your application
hHook = SetWindowsHookEx (WH_CALLWNDPROC,
(HOOKPROC)HookProcedure,
NULL,
GetCurrentThreadId ());
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|