|
Thunking/converting thiscall to callback without using fancy assembler tricks, but adapter objects and C++ standard language features as described in my article Use member functions for C-style callbacks and threads - a general solution.
The article focusses on dealing with the typical Win32 API callbacks, however, the underlaying technique is generic and portable.
--
Daniel Lohmann
http://www.losoft.de
(Hey, this page is worth looking! You can find some free and handy NT tools there )
|
|
|
|
|
I have
while (!m_db1.m_pRecordset->GetadoEOF ())
{
int n = m_db3.m_pRecordset->RecordCount;
m_db3.m_pRecordset->AddNew();
SomeStuffThatAddsAValidRecordToDb3();
m_db1.m_pRecordset->MoveNext();
}
The first time through, when there were zero records in m_db3, there is no problem. Then it advances m_db1 by 1, and gets back to the top of the while. This time when it tries to execute AddNew it crashes. Incidentally, if I move the AddNew() out (just
as a test), then it chokes on both UpDate(), or UpdateBatch(). What am I doing wrong?
Thanks very much
ns
|
|
|
|
|
I tracked it to:
inline HRESULT Recordset15::AddNew ( const _variant_t & FieldList, const _variant_t & Values ) {
HRESULT _hr = raw_AddNew(FieldList, Values);
if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
return _hr;
}
but the odd thing is I'm using it like AddNew() with no arguments. It compiles fine .Suggestions?
If I did make a fieldlist and a values variable what are these? Arrays?
thanks,
ns
|
|
|
|
|
I have a menu in my dialog and when the user does something it needs to use a different menu. What I do:
<br />
CMenu newMenu;<br />
newMenu.LoadMenu( IDR_NEW_MENU );<br />
ASSERT(newMenu);<br />
SetMenu(NULL);<br />
SetMenu( &newMenu );<br />
That displays the new menu, however you can't click on the menu at all. How can I fix this?
There's always one more bug.
|
|
|
|
|
When newMenu goes out of scope, it destroys the menu object as well. Move it to a member variable of the dialog class.
--Mike--
"I'd rather you just give me a fish today, because even if you teach me how to fish, I won't do it. I'm lazy." -- Nish
Just released - 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
I have a MFC framework like this .
I have a CFormView ,a Document class and another CView class in my MDI application .
Initially I want to show the CFormView class as the default and when the user clicks a ToolBar button I want to show (invoke) the CView class to draw some stuff .
The thing that I have in mind is to have 2 MDIDocumentTemplates added to my application .
But how do i switch Between views and how do I add to the Documenttemplates ?
For a better understanding of my problem consider the following :
My FormView contains XML data organized in CTreeCtrl .
In the View i want to draw an Object Tree based on data in the TreeCtrl .
I am really getting confused over this . Please help
|
|
|
|
|
IMHO you shouldn't have 2 document templates but only one. It's the basis of the document-view architecture: for one document containing the data you may have severals views of the same document with different graphical showings. Have a look to
CDocument::AddView[^]
HTH,
K.
Influence of the Evil, Influence of the Good, which of both will go further?
Wobbly destinies, dubious dreams, which of both is good for nothing?
L'emprise du Mal, l'emprise du Bien, lequel des deux ira l'plus loin?
Destins bancals, rêves incertains, lequel des deux est bon à rien?
Come On Boys/Ludwig Von 88
|
|
|
|
|
Hi all.. I downloaded libtiff tiff library.
and I have to create .lib file.
the instruction said that I can use command "nmake /f makefile.vc"
but I the command "nmake" is unknown.. even I'm in the vc++ directory( where vc++6.0 installed).
How can I use vc++ compiler to create lib file.
I tried, file->new->project->win32 static library-> no MFC support.
then I included all the .c and .h files then I clicked build->create lib file. but got lots linking errors.
does anyone know how to create libtiff.lib file?
thanks
|
|
|
|
|
|
thanks I didn't see that b4..
|
|
|
|
|
Hi guys !
Let's say I know how to get the user selection in a multiple selection list box.
Now, how can I take this buffer of text and copy it to the clipboard so someone can copy it to notepad for example ?
I received great help before , waiting for more
Shay Harel
|
|
|
|
|
Use an OLE Clipboard for sending and receiving text data type. I recommend MFC. Otherwise, you are looking implementing your own COM solution.
Kuphryn
|
|
|
|
|
ummmmm
cant he just do GetText() and send it to the clipboard?
"... and so i said to him ... if it don't dance (or code) and you can't eat it either f**k it or throw it away" biz stuff about me
|
|
|
|
|
Thanks,
A small example will be apprtiated.
Shay
|
|
|
|
|
Here is on solution to copy text to the clipboard via MFC wrapper to OLE Clipboard.
-----
CString szText(TEXT("October"));
HANDLE cbData = ::GlobalAlloc(GMEM_MOVEABLE, szText.size() + 1);
PTSTR pData = static_cast<ptstr>(::GlobalLock(cbData));
_tcscpy(pData, szText.data());
::GlobalUnlock(cbData);
COleDataSource *pODS = new COleDataSource;
pODS->CacheGlobalData(CF_TEXT, cbData);
pODS->SetClipboard();
-----
Kuphryn
|
|
|
|
|
HI
When I try to :
COleDataSource *pODS = new COleDataSource;
I get a comiple error of undeclared identifier.
Do I have to #include anything out of the ordinary to use the ole clipboard ?
Thanks once again for you effort, I appreciate it.
Shay
|
|
|
|
|
Greetings...
In a dialog box I am creating one cutsom drawn grid, now when the user presses TAB in the dialog box, the focus is changed to all other control except the Grid ?
I belive since I am creating Grid in the WM_INITDIALOG message of the dialog box the tab is not making focus move to the GRID ?
How do I make the focus move to the grid ?
Thanks
Ritesh
|
|
|
|
|
Try this
form the menu bar when you are in dialog edit screen chhose:Layout->Tab order and force it to be the fist one
Shay
|
|
|
|
|
You need to use the WS_TABSTOP style when creating the window.
--Mike--
"I'd rather you just give me a fish today, because even if you teach me how to fish, I won't do it. I'm lazy." -- Nish
Just released - 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
|
Greetings...
I have 3 edit boxes which are children of a tab control. The tab has 3 tab items with each edit window for its respective work.
Now when the user changes the tab how I make sure that the last page of edit box is always seen ?
I am getting the TCN_SELCHANGING message and am able to trap it but how to show the last page of text fully viewable in the editbox ?
Thanks in advance.
Ritesh
|
|
|
|
|
Did I miss something in the MSDN help files or what? I came to the conclusion that when accessing the serial port (using CreateFile) without overlapping that control remains on the process being performed on the serial port until it is completed (or timed out). The problem I am having is that when I attempt to read a response in from the serial port, its picking up part of the second to last write and all of the last write as well as the incoming data. Any suggestions welcome.
Of all things I've lost... I miss my mind the most
-mjf
|
|
|
|
|
In over 5 years of working with serial ports I have never seen CreateFile do that. However, that will happen when:
1. You are using a radio system.
2. Your remote device echos
3. Your serial line is one of those with only 1 T/R line so you get the cross talk.
This is actually very standard in communications and you will need to be able to ignore your own output.
Tim Smith
"Programmers are always surrounded by complexity; we can not avoid it... If our basic tool, the language in which we design and code our programs, is also complicated, the language itself becomes part of the problem rather that part of the solution."
Hoare - 1980 ACM Turing Award Lecture
|
|
|
|
|
Five years with serial ports... my hats off to you. Been kicked there and back trying to learn to use efficiently this last week. I am nearly ashamed to admit that I didn't realize the device's echo was causing my problem (guess I couldn't see the forest on account of all them trees). Do you have any suggetions as to how I can elimate the echo's just prior to reading the incoming data? If I could just write a little code to strip off the last write that would be good enough be I'm not in control of just what it will be (on account that diffent address's will be sending data and each requires a different (albliet slight) command (the Write).
Either way, thanks for your input... it never ceases to amaze me how a second pair of eyes can that which I cant, even when its right in front of me.
-Mel Feik
Of all things I've lost... I miss my mind the most
-mjf
|
|
|
|
|
will give me all key strokes on all child windows on a CFrameWnd derived class... i need to have capture function key strokes also and have the ability to decide whether they pass through or not
modified 29-Aug-18 21:01pm.
|
|
|
|