|
I'm not sure what you're trying to say. Does CopyFile return an error code when the disk is removed whilst it's being written to, or are you saying that no error is recieved?
One problem may be that you don't seem to have any error checking on the part that writes the log file to disk (as this will obviously fail if there is no disk in the drive)
--
Help me! I'm turning into a grapefruit!
|
|
|
|
|
What´s the definition of hLog´? i´m trying to test it...;)
|
|
|
|
|
HANDLE hLog = NULL;
DWORD dwFileSize = 0;
DWORD dwNBWritten = 0;
DWORD dwErrorCopia = 0
Here you have it...
Thank you for your interest...
|
|
|
|
|
Thanks I will try it
|
|
|
|
|
Hi!!
I have written an application which uses a pointer variable being imported from a dll. The problem is that while debugging there is no problem but when I try to execute the application from command line, it gives invalid memory access error when the imported variable from the dll is accessed. Can any body tell me why this is happening?
Thanks in advance
Shaunak
|
|
|
|
|
Hi,
I am trying to use the static library which is having 4 to 5 functions.In
project settings-link tab i gave the library name and i included the header
files also.In spite of that it is giving this linker error.
What to do next.pl help
IPAddr.obj : error LNK2001: unresolved external symbol "struct value_pair *
__cdecl get_data(char * *,int)" (?get_data@@YAPAUvalue_pair@@PAPADH@Z)
|
|
|
|
|
Try to add the following declaration:
extern struct value_pair * __cdecl get_data(char * *,int);
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
suresh_sathya wrote:
What to do next.pl
I'm sorry, but this isn't a perl forum.
As for your linker error: the linker clearly states it can't find a definition of the (C++ linkage) function. Just a guess, but the lib is a C lib, and the header file declaring this function is missing the needed extern "C" declaration?
#ifdef __cplusplus
extern "C" {
#endif
...
#ifdef __cplusplus
} /* extern "C" */
#endif
|
|
|
|
|
I am playing around the Rectanle object.First I am playing horizontally then vertically.How to increase the speed of Emf files play? I am sending small piece of code.
for(j=1;j<=i;j++)
{
SetRect( &rect1,a,c,a+ezpn_frame_edge,c+ezpn_frame_edge);
// Draw the picture.
pDC->SetStretchBltMode(COLORONCOLOR );
pDC->PlayMetaFile(hemf,&rect1);
SetRect( &rect1,a,d,a+ezpn_frame_edge,d+ezpn_frame_edge);
// Draw the picture.
pDC->SetStretchBltMode(COLORONCOLOR );
pDC->PlayMetaFile(hemf,&rect1);
a+=(ezpn_frame_edge);
a+=ezpn_frame_space;
a-=1;
}
|
|
|
|
|
Hi, everyone!
I am reading a simple class (less than 3K) that encapsulates
WIN32 thread API, I have attached the source codes
as the attachment of the post.
Such are my questions:
1. in function _Entry, what is the function of
the statement? I have known the usage of TLS but
do not know why the class use TLS here.
--------
TlsSetValue(sThreadStorageIndex, theThread)
--------
in function GetCurrent, what is the function of
the statement?
--------
TlsGetValue(sThreadStorageIndex)
--------
2. How to use this class? Can you give me a sample?
Thanks in advance,
George
|
|
|
|
|
Source codes:
class OSThread
{
public:
//
// Call before calling any other OSThread function
static void Initialize();
OSThread();
virtual ~OSThread();
//
// Derived classes must implement their own entry function
virtual void Entry() = 0;
void Start();
static void ThreadYield();
static void Sleep(UInt32 inMsec);
void Join();
void SendStopRequest() { fStopRequested = true; }
Bool16 IsStopRequested() { return fStopRequested; }
void StopAndWaitForThread();
void* GetThreadData() { return fThreadData; }
void SetThreadData(void* inThreadData) { fThreadData = inThreadData; }
// As a convienence to higher levels, each thread has its own date buffer
DateBuffer* GetDateBuffer() { return &fDateBuffer; }
static void* GetMainThreadData() { return sMainThreadData; }
static void SetMainThreadData(void* inData) { sMainThreadData = inData; }
static OSThread* GetCurrent();
private:
static DWORD sThreadStorageIndex;
Bool16 fStopRequested;
Bool16 fJoined;
HANDLE fThreadID;
static unsigned int WINAPI _Entry(LPVOID inThread);
};
void* OSThread::sMainThreadData = NULL;
DWORD OSThread::sThreadStorageIndex = 0;
void OSThread::Initialize()
{
sThreadStorageIndex = ::TlsAlloc();
Assert(sThreadStorageIndex >= 0);
}
OSThread::OSThread()
: fStopRequested(false),
fJoined(false),
fThreadData(NULL)
{
}
OSThread::~OSThread()
{
this->StopAndWaitForThread();
}
void OSThread::Start()
{
unsigned int theId = 0; // We don't care about the identifier
fThreadID = (HANDLE)_beginthreadex( NULL, // Inherit security
0, // Inherit stack size
_Entry, // Entry function
(void*)this, // Entry arg
0, // Begin executing immediately
&theId );
Assert(fThreadID != NULL);
}
void OSThread::StopAndWaitForThread()
{
fStopRequested = true;
if (!fJoined)
Join();
}
void OSThread::Join()
{
// What we're trying to do is allow the thread we want to delete to complete
// running. So we wait for it to stop.
Assert(!fJoined);
fJoined = true;
DWORD theErr = ::WaitForSingleObject(fThreadID, INFINITE);
Assert(theErr == WAIT_OBJECT_0);
}
void OSThread::Sleep(UInt32 inMsec)
{
::Sleep(inMsec);
}
unsigned int WINAPI OSThread::_Entry(LPVOID inThread)
{
OSThread* theThread = (OSThread*)inThread;
bool theErr = ::TlsSetValue(sThreadStorageIndex, theThread);
Assert(theErr == TRUE);
// Run the thread
theThread->Entry();
return NULL;
}
OSThread* OSThread::GetCurrent()
{
return (OSThread *)::TlsGetValue(sThreadStorageIndex);
}
|
|
|
|
|
Hi !
1. I have a MFC dialog based app, and I'd like to add a context menu to the RichEditCtrl I use in it. How do I achieve this ?
2. i'd like to know how to rename a CPropertypage before adding it to the CPropertysheet. I have a dialog that I'd like to reuse three time as is but for its name, which i would like to change. 'tried
CPropertypage ppage;
ppage.SetWindowText("New Caption")
which of course crashed, since the dialog has no handle until it is added to the propertysheet. Any idea ?
Thanks
~RaGE();
|
|
|
|
|
1) I would derivate a new class CMyRichEditCtrl from CRichEditCtrl, adding these functionnalities
void CMyRichEditCtrl::OnRButtonDown(UINT nFlags, CPoint point) <br />
{<br />
CPoint local = point;<br />
ClientToScreen(&point);<br />
GetParent()->SendMessage(WM_CONTEXTMENU, (WPARAM) GetParent()->GetSafeHwnd(), <br />
MAKELPARAM(point.x, point.y));<br />
CRichEditCtrl::OnRButtonDown(nFlags, local);<br />
}<br />
<br />
LRESULT CMyRichEditCtrl::DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam) <br />
{<br />
<br />
if(message == WM_CONTEXTMENU){<br />
GetParent()->SendMessage(WM_CONTEXTMENU, wParam, lParam);<br />
return(0);<br />
}<br />
else<br />
return CRichEditCtrl::DefWindowProc(message, wParam, lParam);<br />
}
The dialog class then implements the answer to the "Context Menu" message (m_RichEdit is an instance of CMyRichEditCtrl):
void CMyDialog::OnContextMenu(CWnd* pWnd, CPoint point) <br />
{<br />
if (point.x == -1 && point.y == -1){<br />
CRect rect;<br />
m_RichEdit.GetClientRect(rect);<br />
m_RichEdit.ClientToScreen(rect);<br />
point = rect.TopLeft();<br />
point.Offset(5, 5);<br />
}else{<br />
CRect codeWindowRect;<br />
<br />
m_RichEdit.GetWindowRect(&codeWindowRect);<br />
if(!codeWindowRect.PtInRect(point))<br />
return;<br />
}<br />
<br />
<br />
CMenu menu;<br />
VERIFY(menu.LoadMenu(IDR_CONTEXT_MENU));<br />
<br />
CMenu *pPopup = menu.GetSubMenu(SUB_CCODE);<br />
ASSERT(pPopup);<br />
<br />
long lStart, lEnd;<br />
m_RichEdit.GetSel(lStart, lEnd);<br />
pPopup->EnableMenuItem(IDC_COPY, <br />
MF_BYCOMMAND | ((lStart != lEnd) ? MF_ENABLED : MF_DISABLED | MF_GRAYED));<br />
pPopup->EnableMenuItem(IDC_CUT, <br />
MF_BYCOMMAND | ((lStart != lEnd) ? MF_ENABLED : MF_DISABLED | MF_GRAYED));<br />
pPopup->EnableMenuItem(IDC_PASTE, <br />
MF_BYCOMMAND | ((m_RichEdit.CanPaste()) ? MF_ENABLED : MF_DISABLED | MF_GRAYED));<br />
pPopup->EnableMenuItem(IDC_CLEAR, <br />
MF_BYCOMMAND | ((lStart != lEnd) ? MF_ENABLED : MF_DISABLED | MF_GRAYED));<br />
pPopup->EnableMenuItem(IDC_UNDO, <br />
MF_BYCOMMAND | ((m_RichEdit.CanUndo()) ? MF_ENABLED : MF_DISABLED | MF_GRAYED));<br />
<br />
pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, this);<br />
}
The dialog class implements also the code for the different menu items.
2) A variation could be to do the "SetWindowText" in the CPropertyPage::OnInitDialog, where the Property Page has a valid HWND.
HTH,
K.
Angels banished from heaven have no choice but to become demons
Cowboy Bebop
|
|
|
|
|
1) Merci beaucoup . I've also found an article on CP about that inbetween, however your solution seems more precise.
2) That's what I thought. I've also tried it (forgot to mention it), like this :
In Dialog
CPropertypage shdlg;
shdlg.m_NewTitle="Hello World"; In CPropertypage::OnInitDialog
SetWindowText(m_NewTitle);
This does not throw an exception, but does not change the title neither.
~RaGE();
|
|
|
|
|
we are developing an e-mail client in school, and I wonder how to authentificate to the mail-server, if sending an mail from home. My teacher said, I have to do a pop3 before I send the mail, but that didn't work (I didn't exactly understood what he means...)
..and now I'm here and asking some real IT-gurus...
thanks
andy
|
|
|
|
|
I assume you're recieving email from the server using pop3, and sending it using smtp?
Basically, some smtp servers will only allow you to send an email if they recognise that you're a valid user. However, smtp doesn't have any kind of login system, so instead you must first connect and login to their pop3 server, then the smtp server will allow you to send mails
--
Help me! I'm turning into a grapefruit!
|
|
|
|
|
Thanks, but I made it this way and it didn't work.
There must be something wrong in my code.
|
|
|
|
|
It works now. I didn't send the correct e-mail address with the rcpt to command.
|
|
|
|
|
Probably anyone, who has ever try to obtain mac address has found page at Winsock Programmer's FAQ and saw all three samples. The most "complicated" method there was SNMP method and it actually works everywhere i tryed. But (there is allways some but)...
After enumerating all mac addresses for my devices, i found myself tiny little confused. I have 2 network cards, one for internal network and one for inet, but i have 4 mac addresses. After some clicking i found two more device drivers. Every one of those two has its own mac address!!
Now the question... how to figure out which mac address is owned by actually hardware (2 ethernet cards)?
I have found one way, to get ip address from winsock and snmp, then match them and get mac address for match, but it is kind a annoying...
Thank you for reading this,
Rok
|
|
|
|
|
I'm using Visual C++ version 6.0.
I don't manually add text to the rich edit control. My application is responsible for displaying text in the MFC rich edit control.
Everytime, a new line of text is added, I want to scroll to the end of the rich edit control. For doing this I use the member RichEditCtrl::ScrollLine.
I know that if I use the ScrollLine function with a number of lines > than the total amount of lines in the rich edit control, the rich edit control is scrolled so that only the last line is shown.
This is certainly not what I want. The result I want to reach is that the last line is displayed at the bottom of the rich edit control, so that as much lines as possible are always visible. This can be compared with setting the focus to the rich edit control and entering CTRL-END.
The problem is that it doesn't work.
The text that is added to the rich edit control is using the Arial font (sometimes size 12, sometimes size 32 or 46). After the RichEditCtrl::ScrollLine the last line(s) is still not visible in the rich edit control, or the last line is only partially shown.
How can I solve this.
One more thing, the apllication is running on a Windows '98 PC.
|
|
|
|
|
I'm doing this with
CRichEditCtrl someCtrl;
someCtrl.LineScroll(someCtrl.GetLineCount());
this scrolls to the end, and displays the last line at the bottom.
-
|
|
|
|
|
On which OS ? I tested my application first on Windows 2000 and there it works fine (I apllied it the same way you did). On Windows '98 however I get a complete other result???
|
|
|
|
|
Sorry, my fault.
I've done this on Windows 2000 and XP, only.
-
|
|
|
|
|
Friends, I developed an application in MFC and link is "statically" with MFC. The application also uses an ActiveX control that i developed.
Now i want to distribute my application's exe with ActiveX control. As i said before that my application is linked statically with MFC. In such case, do i also need to link my ActiveX control statically with MFC or not ?????
|
|
|
|
|
no. you can link your control either way.
-c
Zzzzz...
|
|
|
|
|