|
here is a example with Create Parameters
_RecordsetPtr pRS ;
_CommandPtr pcmdStoredProc;
try
{
hr = pcmdStoredProc.CreateInstance(__uuidof(Command));
if(FAILED(hr))
_com_issue_error(hr);
pcmdStoredProc->ActiveConnection = <Your Connection>
pcmdStoredProc->CommandType = adCmdStoredProc;
pcmdStoredProc->CommandText = _bstr_t("<Stored Proc Name>");
_ParameterPtr param;
_variant_t vtReturnVal(0L);
_variant_t vtReturnVal2(0L);
param = pcmdStoredProc->CreateParameter(_T("<Param 1 Name>"),adInteger,adParamOutput,sizeof(long),vtReturnVal);
pcmdStoredProc->Parameters->Append(param);
param = pcmdStoredProc->CreateParameter(_T("<Param 2 Name>"),adInteger,adParamOutput,sizeof(long),vtReturnVal2);
pcmdStoredProc->Parameters->Append(param);
param = pcmdStoredProc->CreateParameter(_T("<Param 3 Name>"),adInteger,adParamInput,sizeof(long), _variant_t((long)10));
pcmdStoredProc->Parameters->Append(param);
param = pcmdStoredProc->CreateParameter(_T("Param 4 Name>"),adInteger,adParamInput,sizeof(long), _variant_t((long)-1));
pcmdStoredProc->Parameters->Append(param);
pRS = pcmdStoredProc->Execute(NULL, NULL, adCmdStoredProc);
}
catch(_com_error& e)
{
CString sBuff = GetErrorDescription(e);
AfxMessageBox(sBuff);
return;
}
catch(...)
{
AfxMessageBox("Unknown Error Occured");
return;
}
|
|
|
|
|
Hi.
Help me to use database in dialog base program.
Iman Ghasr-e-fakhri
|
|
|
|
|
Hi.
what can I do to maneging mouse move event on buttons.
Iman Ghasr-e-fakhri
|
|
|
|
|
What are you asking ? WM_MOUSEMOVE is called when you move the mouse, and WM_LBUTTONDOWN/UP/etc are called when you press a button. To tell if a button is down as the mouse is moved you can use GetAsyncKeyState(VK_LBUTTON). You should call it twice, once to clear the buffer and once to check if it's down now, like so
GetAsyncKeyState(VK_LBUTTON); // may return true because it was down since the last check
if (GetAsyncKeyState(VK_LBUTTON))
// NOW we can do something
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
Hi.
What can I do to chenge Edit Box (with CEdit) text color & BackGround color
Iman Ghasr-e-fakhri
|
|
|
|
|
How can I set a CEdit box up such that the enter key must be pressed before an OnChangeEdit Msg is generated? That is, the user must press enter before the edit box data is processed.
Thanks.
Richard
|
|
|
|
|
Hi My friends.
I want to use MFC Singel Document
to Type Equetio with "Breaking line" or "fraction line"
......2
....5x + 6
z=.--------
.....2y
(I don't know use this words corect or not) like this
I nead draw line and text together.
what can I do to have "Cursor" to type text & able to draw line .
Iman Ghasr-e-fakhri
|
|
|
|
|
Nothing - Windows is a graphical system - you can accept text and draw it into the view, and you can draw a line on the view as well.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
In MS Word 97, when I drag any toolbar (such as drawing toolbar) and drop it on the Word window, it becomes a window with small title bar, when I click on a button on the toolbar, the cursor on MS Word window still blink and MS Word window is still active. Vice versus, when I type, the toolbar window is still active. I try to create a window like that by the API Fuction CreateWindowEx and set window style as WS_Ex_TOOLWINDOW, and its parent as another window;
However, this window becomes de-active when I click on its parent window. I wish to receive any explaination for this phenomenon. Thank you very much.
|
|
|
|
|
I have a question that's realy bothering me.
when I look at the forums question and answers,
I see that the text is on a blue background and sometimes an example code on an orange background.
How do you do that ????
Name: STR
BTW: for some of you that wished for CodeProject irc server
I create a channle on DalNet called "#CodeProject"
|
|
|
|
|
This board accepts html tags in your posting. To include blocks of code you can use <PRE> or <CODE>
If I put in
<PRE>
Some text
</PRE>
I get:
Some Text
<CODE> Produces text
<br />
Like<br />
This<br />
(To make actual HTML appear as text you use "<" in place of "<")
|
|
|
|
|
Sagiv
this is done using the HTML tags <pre> and </pre>. You place them around your code and they keep the formatting exactly as you had it. Start your code immediately after <pre> on the same line or else you will get a blank line above your code. If you want to have a blank line between code you need to have a space on the line.
void main()
{
return;
}
Michael Martin
Pegasystems Pty Ltd
Australia
martm@pegasystems.com
+61 413-004-018
|
|
|
|
|
In properties on my MSFlexGrid I have Selectionmode by row.
But why is not the entire row highlighted when I click in the grid. The first colomn in the row is never highlightened, but the rest is highlightened.
|
|
|
|
|
Check that you have the property FocusRect to none, if not, the grid won't highlight the cell with the focus
|
|
|
|
|
void CExFormViewView::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
CClientDC dc(this);
CPen pen, *oldpen;
pen.CreatePen(PS_SOLID, 1, RGB(255, 0, 0));
oldpen = dc.SelectObject(&pen);
dc.MoveTo(0, 0);
dc.LineTo(220, 100);
dc.SelectObject(oldpen);
}
The problem is to be not run the code above, at running for the first time.
The program is made to formview-based.
Help !!
|
|
|
|
|
Sorry if anyone feels I'm posting in the wrong forum, but this question did not really fit in in any of the others.
My problem is that I can't get the insertBefore method to work when adding new elements/nodes to my xml document.
This is my xml document:
<?xml version="1.0" encoding="ISO-8859-1"?>
<names>
<name>Flanders, Ned</name>
<name>Gumble, Barney</name>
<name>Skinner, Seymour</name>
</names>
Now I would like to do a insert with a new name "Simpson, Homer" so that it is placed before "Skinner, Seymour".
According to the MSDN specification the insertBefore method takes two arguments: newChild and refChild. But what confuses me is that refChild is supposed to be a variant, and not just a node pointer. I've tried different approaches but I've only managed to insert the new name at the end of the list.
Does anyone have some code samples using insertBefore in VC++? I would be very grateful. I've been looking for examples everywhere but found none that helps me.
Thanks!
|
|
|
|
|
Jimmy,
I use the following code to do this:
_variant_t varBeforeNode(pBeforeNode.GetInterfacePtr(), false);
pParentNode->insertBefore(pNewNode, varBeforeNode);
This also works if you pass 0 as pBeforeNode, in which case
the element is appended to the end of the list.
Alwin Beukers
|
|
|
|
|
Thanks for your help.
The problem was that I did not know what to initiate the second parameter (varBeforeNode) with. After a lot of experimenting I found that it worked if I created a VARIANT and initiated it with the node pointer and set the variant type to unknown. Like this:
VARIANT var;
var.byref = myNodePtr;
var.vt = VT_UNKNOWN;
parentNodePtr->insertBefore(pNewNode, var);
I figured this out just a few minutes ago and hopefully this example will help others save some time. If anyone's looking for an example I could send you some code. Just drop me a line.
|
|
|
|
|
Hi all,
Can anyone learn to me Visual C++ tools for debuging ? about watch windows and ...
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Just so long as you stop asking questions that have short answers (that's a joke BTW)
First and foremost I recomend the book 'Debugging Windows' by Robbins ( can't see the first name from here ). As to the basics, you need to hit F5 in debug build to start debugging. You set breakpoints by hitting F9, and when the code reaches one it will stop and enter the debugger. You can type variable names into the watch window to see their contents, hit F10 to step through lines and F11 to step into them. In other words, F10 will execute a function and move to the next line, F11 steps into the function line by line.
What else would you like to know ?
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
Hi,
With CHTML view is it possible to get it to show the IE Toolbar and menu bar. There is member functions like, SetToolbar, and menu bar. But can't seem to get it to work, when create a simple MDI MFC appwizzard application.
Thanks again
Richard
|
|
|
|
|
CHtmlView is a MFC wrapper over WebBrowser control. You can call CHtmlView::SetMenuBar or CHtmlView::SetToolBar, but these calls will be ignored.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Hi,
I am having trouble viewing my variables in watch window from debug mode.
when i insert a break point and try to view _b_str
varaible it is being displayed only partialy followed by some integer:
for example string like this:
SELECT * FROM my_table where when_closed = -1 AND job_id = 1386
will appear like:
SELECT * FROM my_table where when_closed (1)
How can I view the whole string?
thank you
|
|
|
|
|
_bstr_t uses reference counting, that's why (1) is displayed. I have no idea why string is partially displayed - are you absolutely sure that your string contains "job_id = 1386"? On my workstation there's no such effect; I can see complete string.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Thank you for replaying.
I am sure that string contains job_id = 1386 and much more. In many places where i try to see value of variables of type _bstr_t whenever it is getting long I can only see part of it in watch window.
someone suggested to check option in tools/options/debug unicode string and now i am getting a little more but still some part is missing.
example (the one i described earlier but with unicode string check out)
_bstr_t str : result in watch window (incomplete string)
{"SELECT * from Main_view where (job_id = 1636 OR project_id = 1636)AND ( ( person_1 = 'Baniewicz Małgorzata' ) OR (person_1 = " (1)}
_bstr_t str1 : result in watch window (complete string)
{"AND ( ( person_1 = 'Baniewicz Małgorzata' ) OR (person_1 = 'Bauer Piotr' ) OR (person_1 = 'Bejm Maciej' ))"}
str should have all str1 in itself (program is working correctly, but watch still does not display some part - in str's (1) place should be: 'Bauer Piotr' ) OR (person_1 = 'Bejm Maciej' ))"} - the end of str1, but it does not appear.
do not know why ?
|
|
|
|