|
Try \r\n instead of \n on its own.
Cheers.
|
|
|
|
|
I thought I'd just done something wierd last time, because I created a new object and was able to use it right away using the code I posted before. But now I've created a new ATL project, on a different machine and the same thing is happening.
I create an ATL object, I create a method, and I compile it. I use MinDependency, making sure I specify -GX for try/catch unwinding and remove _ATL_MIN_CRT if necessary.
Then I #import the .tlb file in my stdafx of a brand new, stock standard dialog project. I call CoInitialise(NULL) before anything else in InitInstance, and in ExitInstance I call CoUninitialise().
Then in my OnInitDialog I try something like IMyClassPtr ptr(_uuidof(MyClass)); and if I do it in a try catch block I get a Message Box up with the _com_error ErrorMessage(), which is Class Not Registered ( or something similar, maybe Object Not Registered ? ).
I have tried RegSrv32 to register it myself, verified it has the proper Registry entries ( to the best of my knowledge, the name is stored under the IID with some other info ), and this despite VC++ putting up a 'registering server' type message when I compile. I've tried other methods of creating the file and my pointer is always NULL. The book I am working from seems to assume what I am doing will *always* work, because it gives no further info. Is there something glaringly obvious I am doing wrong ?
Thanks again...
Christian
Secrets of a happy marriage #27:
Never go to bed if you are mad at each other. It's more fun to stay up and fight.
|
|
|
|
|
If your interface not derives from IDispatch then
it should have proxy-stub also being registered.
You should build and register YourClassps.dll .
There is YourClassps.mk makefile to help.
|
|
|
|
|
Hi,
I have a CWnd that I create in my CScrollView::OnCreate(...) like so:
int CMyScrollView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CScrollView::OnCreate(lpCreateStruct) == -1)
return -1;
m_myCwnd.Create( NULL, "", WS_CHILD|WS_VISIBLE|WS_BORDER, CRect(50,50,100,100), this, 23423 );
m_myCwnd.Create( this );
return 0;
}
Then in my CScrollView::OnSize(...) I want to make the CWnd the same size as the CScrollView so I call MoveWindow(...) like so:
void CMyScrollView::OnSize(UINT nType, int cx, int cy)
{
CRect myRect;
GetClientRect(&myRect);
ClientToScreen(myRect);
m_myCwnd.MoveWindow(myRect.left, myRect.top, myRect.Width(), myRect.Height(), TRUE);
CScrollView::OnSize(nType, cx, cy);
}
The problem is that after the call to MoveWindow(...) nothing happens, my CWnd is still the same size and position as when it was created.
Does anyone have any idea wht I'm doing incorrectly?
Any help would be greatly appreciated,
Craig
|
|
|
|
|
Dear All
When I install the visual C++, I find an option under tools for creating "Self Extracting exe" - how can I make use of this??
regards
Sankar
|
|
|
|
|
Hey
How do I access the files that I select when I goto "Open" in an MFC built SDI app?
What is the string of the path, or how can I then open that file for reading??
AND
How can I stop the default "new file" on start up, and get it to wait for a document to be specified to open?
Please help a desparate newbie!
Tim T
|
|
|
|
|
Come on guys, this is really important to me!
Please!
|
|
|
|
|
OK!
In your new app, go to the class wizard, select the object ID called "ID_FILE_OPEN". Then click on the COMMAND text in the box marked "Messages". Next, click "Add function" and it'll prompt you to name the function - probably "OnFileOpen".
It will generate a member function called OnFileOpen() somewhere in your code, probably as part of your mainframe class. So, you find your OnFileOpen() function, which will be empty except for some comments like "Add your command handler code here".
Add some code like this to your OnFileOpen() function:
{
CString strFilter;
CString path;
FILE *myfile;
CFileDialog MyFileDialog(TRUE,
"*.txt",
NULL,
NULL,
"Text file (*.txt)|*.txt" );
/* Display the File Dialog box */
int result = MyFileDialog.DoModal();
/* Return the path (including filename) */
path = MyFileDialog.GetPathName();
/* Open it up */
myfile = fopen(path, "r");
/* etc...*/
}
Haven't tested this out but it might be worth a bash. As for your second question, no idea but I've noticed that the behaviour differs between Win9x and Win NT.
Hope it helps. Cheers.
|
|
|
|
|
I want to change the order in which my controls react on the tabstop.
I.e. I want to change the tabstop-order, how can I do this?
|
|
|
|
|
Select the dialog that contains your controls. Then go to the 'Layout' menu and select 'Tab Order'.
You'll see a whole bunch of numbers which denote the order that the tabs are set to. Click on these numbers to adjust the order. Your first click will be the first tab, second click will be the second tab, and so on...
Hope this helps.
|
|
|
|
|
Thanks a lot!!
Works fine
|
|
|
|
|
Hi
I want to paint some items in my CListView-derivered class in different colors.
I know how this works with CListCtrl, you have to work with these functions:
afx_msg void DoNotify(NMHDR* pNMHDR, LRESULT* pResult);
and you have to set a ON_NOTIFY(NM_CUSTOMDRAW, IDC_ONLINE, DoNotify) into the Message-map
But ON_NOTIFY requiers a control-id from a CListCtrl.
So how can I do it with a CListView not CListCtrl?
thanks in advance
|
|
|
|
|
Use the ON_NOTIFY_REFLECT macro in your view class.
--Mike--
http://home.inreach.com/mdunn/
"Make sure that if you are using a blow torch that you don't set anything on fire."
-- Chris Maunder
|
|
|
|
|
Yeah thanks, I just found out by myself.
Could you please tell me what's wrong with this code:
The items are not painted in red font-color
NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<nmlvcustomdraw*>( pNMHDR );
if ( CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage )
{
*pResult = CDRF_NOTIFYITEMDRAW;
}
else if ( CDDS_ITEMPREPAINT || CDDS_SUBITEM == pLVCD->nmcd.dwDrawStage )
{
*pResult = CDRF_NOTIFYSUBITEMDRAW;
}
else if ( (CDDS_ITEMPREPAINT) == pLVCD->nmcd.dwDrawStage )
{
COLORREF crText;
crText = RGB(255,0,0);
pLVCD->clrText = crText;
*pResult = CDRF_DODEFAULT;
}
thanks
|
|
|
|
|
It found out again, no more help needed
|
|
|
|
|
Hi,
How can I use CFileFind to search for more than one type of file at once - like if I want to search for .cpp and .h files in one sweep. I know I can create a class for each search but on a global search that will require searching my whole computer for each file type.
Cheers
James
|
|
|
|
|
Hi,
I would like the command for know how datas I have in my serial buffer .
Thanks
youssef
|
|
|
|
|
One way is to call ClearCommError. This will fill a COMSTAT structure, whose cbInQue member will then hold the number of chars in the buffer.
|
|
|
|
|
Dear,
Thank you for your answer.
I use ClearCommError, COMSTAT and cbInQue;
Best regards
youssef
|
|
|
|
|
|
Oeps, forgot to escape something
value1 <empty> <epmty>
value1 <a value> <a value>
value2 <a value> <a value>
value3 <empty> <empty>
value3 <a value> <a value>
Wim
|
|
|
|
|
My guess is that the list control has one of the sort styles set, but your code expects the list not to be sorting for you.
--Mike--
http://home.inreach.com/mdunn/
"Make sure that if you are using a blow torch that you don't set anything on fire."
-- Chris Maunder
|
|
|
|
|
Good Guess!
Thanks a lot.
Wim
|
|
|
|
|
Hi
what's the best method to add bytes to the *middle* of a binary file?
do i have to read in the data that would otherwise be overwritten, to the end of the file, append the file and then write the data record to a later offset?
Or is there a built in function.....
Cheers
Wills
|
|
|
|
|
Hello? Does anybody know the answer to my question?
Wills
|
|
|
|