|
Hi,
We use CreateEvent() API to create event object.
This Event Object is recognized in the local system.
When it comes to Remote Systems is there any API similar to CreateEvent() for notification?
Thanks.
Yamuna.E.
|
|
|
|
|
I have a constructor defined as shown:
CFirstClass:: CFirstClass(const CFirstClass &myClass)
{
// some code
CFirstClass* pAnotherFirstClass;
pAnotherFirstClass= &myClass; // error on this line
// code
}
The error states:
error C2440: '=' : cannot convert from 'const class CRegisterItem *' to 'const int'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
pls help.
|
|
|
|
|
This sort of error often means a missing #include file, in this case the one for CRegisterItem. It's hard to figure out, because from your code I have no idea what a CRegisterItem *is* ( I don't believe it's MFC, although I've been wrong before ).
Christian
#include <std_disclaimer.h>
|
|
|
|
|
Change
CFirstClass* pAnotherFirstClass
to
const CFirstClass* pAnotherFirstClass
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
I need a list of lists, something like:
CList[CList[CPoint,CPoint&],CList[CPoint,CPoint&]&]path;
(I've put [ and ] instead of less and greater sign because of HTML formatting.) How to do it
|
|
|
|
|
Try this:
typedef CList<CPoint, CPoint&> PointList;
typedef CList<PointList, PointList&> Path;
|
|
|
|
|
I've tried it before, it doesn't work.
|
|
|
|
|
Hi!
I have a very simple class used to display a checkbox, filled or not depending on if a task is finished. I the dialog editor, I set the SS_REALSIZEIMAGE property. This works great, until the image is set using SetIcon. After that call, CStatic formats the icon as a 32x32, which I don't like.
I've tried to use ModifyStyle and RedrawWindow after the call to SetIcon, but no success.
My code:
void CTaskFinishedCheck::SetFinished(BOOL bFinished)
{
if ( bFinished )
{
SetIcon( hCheckedIcon );
}
else
{
SetIcon( hUncheckedIcon );
}
}
Someone who knows?
|
|
|
|
|
Hi!
Use the ::LoadImage API function instead of CWinApp::LoadIcon(). For example:
HINSTANCE hInst = AfxGetInstanceHandle();
hIcon = (HICON) ::LoadImage(hInst, MAKEINTRESOURCE(IDI_FOOBAR), IMAGE_ICON, 16, 16, 0);
Hope this helps!
|
|
|
|
|
It did. Thanks. I must learn to read the whole Remark section.
|
|
|
|
|
Thx, I experienced the same problem using CStatic::SetIcon with dynamically loaded icon thru LoadIcon. The LoadIcon function seems to scale down any icon dimension back to system defaults (e.g. (32, 32)).
|
|
|
|
|
I am using this code to download a INET File
CFile ofile;
ofile.Open(_T("globe.gif"), CFile::modeWrite | CFile::modeCreate | CFile::typeBinary);
DWORD dread;
BYTE szBuff[1024];
//assumes URL names have been initialized
CInternetSession session("My Session");
CStdioFile* pFile = NULL;
pFile = session.OpenURL(_T("http://..."), 1, INTERNET_FLAG_TRANSFER_BINARY);
while ((dread = pFile->Read(szBuff,1024)) > 0)
{
ofile.Write(szBuff, dread);
}
delete pFile;
session.Close();
This code works alright but I with the code above if my laptop is away from my INET connection there is ASSERT or Exception in CStdioFile::Read() or CStdioFile::Close().
I have used the code below w/ CStdioFile before but w/ the code above CStdioFile::m_pStream seems to always be NULL.
CStdioFile StdioFile;
//use it
if(StdioFile.m_pStream != NULL)
{
FileSaver.Close();
}
So is there a quick way to this the return val of CInternetSession::OpenURL() w/out using TRY/CATCH Blocks or Exceptions. Please these for some reason get the best of me for now.
Thank you...
|
|
|
|
|
Hi
I like the idea of the __try/__finally block, where you can put all your clean up code in the one spot. I'm doing lots of ADO COM stuff... getting recordsets, etc., so I've got a catch(_com_error & e) handler. Is there anyway I can also have a __finally block?
All the MSDN stuff says is "MFC has no concept of termination handlers"
I know its possible to combine SEH and C++ exception handling by using the MFC class SEHException but this won't help me will it?
Thanks
Brendan
|
|
|
|
|
I wrote an OCX (that dynamically links MFC) using VC6. I wrote a test app that exercises the OCX in VC6, and the OCX appears to work fine.
I then wrote a test app in VB6, and this is where my sad story begins.
The OCX has some string properties, and these properties have Get/Set functions associated with them. If you're at all familiar with VB, you know that while you're running your app (from the VC6 IDE), you can hover your mouse over an OCX property name and a toolitip will popup giving you the value/contents of that property. For all but one property, this works fine, but when I try to hover the mouse over one of them (happens to be a string that holds an IP address), it *crashes the VB IDE*. After a little experimenting, I found that if I deleted the periods from the IP address in the string (did this in the OCX itself in the Get() function), it worked fine.
In the OCX, my Get/Set functions look like this:
CString m_sXXXProperty;
VARIANT CMyOcxCtrl::GetXXXProperty()
{
_variant_t vaResult;
vaResult = (const char*)m_sXXXProperty;
return vaResult;
}
void CMyOcxCtrl::SetXXXProperty(const VARIANT FAR& newValue)
{
_variant_t vTemp(newValue);
m_sXXXProperty = vTemp.bstrVal;
SetModifiedFlag();
}
First, I need to knbow if I'm doing anything wrong in the code above. Second, I need to know why in hell the dots in the IP address would cause a crash in VB.
In the VB test app, I cycle through a counter (also retrieved from the OCX) to retrieve other strings (using the same mechanism described above), but these strings are not properties. After I have called a retrieval function, the string in the VB app contains the expected text. However, when IO put that string into a listbox, all I get is the first character shown in the listbox.
I don't know much about VB, and really prefer not to know any more than I need to get this test app working as expected. I strongly suspect that my problem lies in the OCX functions that return the strings.
Keep in mind that this OCX works *fine* from the VC6 test application.
Any help would be appreciated.
|
|
|
|
|
Disclaimer: I've never written a COM object with MFC.
I think that some of the problem might be that you are passing a CString back to VB. VB is probably looking for a BSTR. COM works with UNICODE, not ascii, so that may be the first problem: The result is getting turned into a bunch of non-ascii UNICODE characters. Since Unicode is looking for a 16-bit null character, VB is probably not finding one and is blowing up. I don't know why this would work in C++.
I don't know if MFC does any conversions or not...take a look at the _bstr_t data type and break out the USES_CONVERSION and associated macros (OLE2T etc).
If you are only seeing the first character, that is likely some sort of Unicode / ascii conversion problem. COM works with Unicode. If the Unicode is converted to ascii without "proper conversion", it will display the first character only because the ASCII character set occupies the unicode positions 0-255.
The string "ABC" in unicode would have the byte pattern "A\0B\0C\0"
hope this helps.
If you need to pass strings to a VB app, why not use the BSTR type in your C++ component? That will map to a VB String variable directly.
"Harland Pepper, would you stop naming nuts" - Harland Pepper
|
|
|
|
|
I think that you need this....
CString m_strProperty = _T("");
STDMETHODIMP CCPerson::get_Property(BSTR *pVal)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState())
// TODO: Add your implementation code here
::SysFreeString(*pVal);
*pVal = m_strProperty.AllocSysString();
return S_OK;
}
STDMETHODIMP CCPerson::put_Property(BSTR newVal)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState())
// TODO: Add your implementation code here
m_strProperty = newVal;
return S_OK;
}
Cheers.
Carlos Antollini.
|
|
|
|
|
This isn't a COM object as much as it is an OCX. The Get/Set functions were inserted by ClassWizard, and they accept/return VARIANT's. I'm using the _variant_t wrapper class because it's easier to work with (or so I thought).
|
|
|
|
|
in the code you show that you are using VARIANT return type for your property;
may be the vb ide gets an ip-address wrong as anumber (with to many dots in it).
Try using BSTR (*) ? as return type to get a real vb string, (or may be you only
need to set vaResult.vt to the right variant type constant)
|
|
|
|
|
This is a question on system programming (like Windows API, hardware programming, etc).
How to read a disk directly in Windows (under Win32)? I need the following equivalent of DOS functions:
INT 25h/26h -- absolute disk read/write (i.e. reading logical disk sector)
INT 13h -- physical disk sector read/write
I need the equivalence of INT 25/26 *very badly*. Especially the READ function. This should be something trivial. If you know an URL containing this info, I would appreciate it.
Assume I will write the program under generic C++ program (GNU C++). But if you know something, you can assume other things if you want, but *I don't* have Delphi, MSVC, etc.... Please... I need someone help me find the right reference.
Thanks,
Wirawan
|
|
|
|
|
Just curious: why do you need this functionality?
Cheers,
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
I have a list box in my project and i need the user to be abel to delete an object from the listbox but you can only delete a strings if you know the number place where the string is in in the box. How can i have the project find the number sting when the string is clicked?
Justin
|
|
|
|
|
GetCurSel returns the current selection index. So you go m_List.DeleteString(m_List.GetCurSel());
Christian
I've learned that you cannot make someone love you. All you can do is stalk them and hope they panic and give in.
The early bird may get the worm, but it's the second mouse that gets the cheese.
|
|
|
|
|
If your going to make this like you are why don't you do it in QBASIC. It would be so simple you could finish it in a few minutes. If you want I can help you do it in QBASIC, E-MAIL me @ rcdude10tc3@aol.com, c ya
Justin
|
|
|
|
|
1) You haven't told us what you want help for.
2) This looks like a school homework assignment. I have a real problem finishing someone's homework for them. If this is an incorrect assumption, I'll apologize now, but I don't want to see CodeProject become a haven for folks too lazy to learn how to do stuff on their own (when it's necessary for them to do so).
|
|
|
|
|
Well, don't you think asking specific questions would get you a specific answer a lot freakin faster? If you cop an attitude, you'll get attitude back.
[attitude]
Go somewhere else if you want someone to finish your homework assignment for you. I have a idea, go ask your instructor.
[/attitude]
yawn...
|
|
|
|