|
in a console based application the code goes like this
int i=10;<br />
int j=20; <br />
int k=i+j;<br />
Console ::WriteLine (k.ToString());<br />
and yes as far as the answer to your second question is concerned let me make it clear with thousands of developers working on VC++ it's not going anywhere right now. It would take a long time to make applications without VC++ for half of the world
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
-- modified at 2:49 Tuesday 13th June, 2006
|
|
|
|
|
Thank you! but I am unaware of the programming pattern in VC++.Net or else is it the same as in VC++
//Taking simple interger addition function as an example
#include....
void main(void)
{
int i=10,j=20,k;
k=add(i,j);
Console::WriteLine (k.ToString());
}
int add(int a, int b)
{
return (a+b);
}
Please also tell me that to which header file does this ToString() function belong?
Thanks Once again
Gagan..
|
|
|
|
|
|
There are classes belonging to the System namespace.
Ex:
Int32 belongs to System namespace and ToString is the overriden function in that class.
The programming technique is a bit different when it comes to using .NET .
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
currently i am using the ADC0808 to change analog signal to digital and RS-232 serial cable to interface with my computer.But i face a problem how to write the Visual c++ or Matlab program for interfacing and signal processing.So any one interested to help is very welcome.
thank you in advance.
|
|
|
|
|
|
Hello,
I have to replace the occurances (which is near about 700) of a macro say ASSERT with its extended functionality say EXT_ASSERT. I can do in the following ways:
1. #define ASSERT EXT_ASSERT - but in this case if anyone want to use ASSERT he can not use it.
2. replace all the 700 occurances - replacing like this is difficult and more error prone.
Can any one tell me the better way of doing this.
Thanks and regards,
Ritesh S.
|
|
|
|
|
Ritesh wrote:
if anyone want to use ASSERT he can not use it.
what do you mean anyone ??
ASSERT is works in DEBUG mode only.
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
Hello! Mr. Ritesh
This question is quite interesting. I also even tried typedef but failed. But you can create a small string-based program that can read the whole file and will replace the string ASSERT with the specified word "EXT_ASSERT" simultaneously. I know its a lengthy and time-consuming procedure.
I hope there would be another way to solve this problem.
Gagan..
|
|
|
|
|
Ritesh S. wrote: replace all the 700 occurances - replacing like this is difficult and more error prone
Replacing in multiple files is less difficult if you use Edit --> Find and Replace --> Replace in Files command and specify Match case and Match whole word options.
|
|
|
|
|
I have created a modeless dialog box(suppose dlg2) and is being shown when a button is pressed in another dialogbox(dlg1).The problem is when dlg2 is o n top of all the windows i am clicking on the dlg1. It is getting activated but not comming to top of all windows. How to do this.
Please help me regarding this.
Thank You
KIRAN
|
|
|
|
|
kiran.pinjarla wrote: The problem is when dlg2 is o n top of all the windows i am clicking on the dlg1. It is getting activated but not comming to top of all windows. How to do this.
If your dlg1 is also Modeless then check how you showed the dialog which may restricts your dlg2 to come at front.
Knock out 't' from can't,
You can if you think you can
-- modified at 2:12 Tuesday 13th June, 2006
|
|
|
|
|
are you setting the style of the dialog as child.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
This may be the wrong way to do it, but you could set the parent for the second dialog to the Desktop window like GetDesktopWindow() .
this is this.
|
|
|
|
|
Use:
HWND GetActiveWindow(VOID);
and then use BringWindowToTop() function
Cheers
"Peace of mind through Technology"
|
|
|
|
|
Nish has a good work around for this problem. this one i have taken from voidnish.com
He says:
How to steal focus on 2K/XP
I bet that sometimes you long for the old days when a simple SetForegroundWindow brought your dialog into focus. Sigh! Now with 2K/XP things have sorta changed so that if you try a simple SetForegroundWindow you end up flashing the taskbar icon a few times (I never counted but something tells me it flashes thrice). Not exactly what you wanted to do, eh? Luckily there are ways to bring your dialog into the foreground.
The trick is to use AttachThreadInput to attach the thread that owns the current foreground window to our thread, then call SetForegroundWindow and then detach the attached thread, again using AttachThreadInput. Cool, huh?
AttachThreadInput(
GetWindowThreadProcessId(
::GetForegroundWindow(),NULL),
GetCurrentThreadId(),TRUE);
SetForegroundWindow();
SetFocus();
AttachThreadInput(
GetWindowThreadProcessId(
::GetForegroundWindow(),NULL),
GetCurrentThreadId(),FALSE);
SaRath.
"Don't Do Different things... Do Things Differently..."
Understanding State Pattern in C++
|
|
|
|
|
Hi,
I have used Splitter window and did a (1 row,2 cols ) split and Created Views for the Corresponding two panes. The View in the left pane has tree control in it and in the right pane has form view.
If I Click on the Items in the left pane I don't have any problem but if I
click the view in right pane and again click the left pane I am getting an exception.
CCreateContext context;
context.m_pCurrentFrame = NULL;
context.m_pCurrentDoc = GetActiveDocument();
//Getting an Exception in the above Line
context.m_pNewViewClass = NULL;
context.m_pNewDocTemplate = NULL ;
Any suggestions Please
Thanx in advance
|
|
|
|
|
In the good old days I believe people were using the arcane technology which came to be known as COM+ to embed other application's document in their own document.
Like a Word with document a Windows Media Player or Excel or Visio document inside, double click on it and *bang* you coud start edit it using Excel/WMP/Visio toolbar.
Apparently even OpenOffice could do that.
Now here is my question:
I'm a new generation programmer. Blissfully ignorant of such thing.
But I would like to know and embed Word, Excel or other kind of document in my application's own document!
How could I do that?
And is there an up-to-date technology (i.e.: .NET API) to do that?
|
|
|
|
|
i ahve one bitmap loaded in picture control with scrollbars .know what i want is when we click the bitmap and dragged it should move to corresponding co-ordinates.
for example.
in irfan view when the image is bigger then a window then mouse cursor will change his shape to hand. we drag to see the full picture
thank u in advance.
sreee
|
|
|
|
|
sree_as wrote: i ahve one bitmap loaded in picture control with scrollbars .know what i want is when we click the bitmap and dragged it should move to corresponding co-ordinates.
for example.
in irfan view when the image is bigger then a window then mouse cursor will change his shape to hand. we drag to see the full picture
thank u in advance.
You have to override OnMousemove method..track the mouse cooridates when LBUTTON is DOWN and bitblt the bitmap with the proportion of the mouse coordinates so that your bitmap will display fully.
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
thank u laxman.
i intension is hwen click the lButton and drag to some point then Lbutton up then bitmap should move to corridinates how many we dragged.
thank u
sree
|
|
|
|
|
When you click down and the image is scrollable, set a flag to indicate that the mouse is down and set the capture to the window and change the cursor to the hand cursor.
When the mouse moves store the previous x y position the mouse is at. If the mouse is down you take the current position and previous position, find the offset and scroll your window appropriately.
When the mouse button goes up clear the flag to indicate the mouse is down and release the capture and set the cursor back to the arrow cursor.
|
|
|
|
|
thank u .
any sample code or any link please.
sree.
|
|
|
|
|
Exactly what problem are you facing? Depending on how you are actually doing the scrolling (setting x and y start point and invalidating the window in the OnVScroll/OnHScroll handler etc) this can't be more than a couple of lines of code.
Show what you currently have in your OnLButtonDown/OnMouseMove/OnLButtonUp handlers and then someone might help you.
-- modified at 2:55 Tuesday 13th June, 2006
|
|
|
|
|
<br />
void CImageDlg::OnLButtonDown(UINT nFlags, CPoint point) <br />
{<br />
as=true;<br />
<br />
SetScrollPos(SB_VERT,point.y,true);<br />
SetScrollPos(SB_HORZ,point.x,true);<br />
SetCapture();<br />
<br />
<br />
<br />
CDialog::OnLButtonDown(nFlags, point);<br />
}<br />
<br />
void CImageDlg::OnLButtonUp(UINT nFlags, CPoint point) <br />
{<br />
ReleaseCapture(); <br />
<br />
as=false;<br />
<br />
CDialog::OnLButtonUp(nFlags, point);<br />
}<br />
<br />
void CImageDlg::OnMouseMove(UINT nFlags, CPoint point) <br />
{<br />
<br />
<br />
if((point.x>=89&&point.x<=363)&&(point.y>=67&&point.y<=271))<br />
SetClassLong(m_hWnd,GCL_HCURSOR,(LONG)LoadCursor(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDC_CURSOR1)));<br />
else<br />
SetClassLong(m_hWnd,GCL_HCURSOR,(LONG)LoadCursor(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDC_CURSOR2)));<br />
<br />
<br />
<br />
<br />
if (as==true)<br />
{<br />
SetScrollPos(SB_HORZ,point.x,TRUE);<br />
m_bitmap.SetWindowPos(NULL,<br />
-point.x,<br />
view.top,<br />
0, 0,<br />
SWP_NOSIZE | SWP_NOZORDER);<br />
SetScrollPos(SB_VERT,point.y,TRUE);<br />
m_bitmap.SetWindowPos(NULL,<br />
view.left,<br />
-point.y,<br />
0, 0,<br />
SWP_NOSIZE | SWP_NOZORDER);<br />
}<br />
CDialog::OnMouseMove(nFlags, point);<br />
}
|
|
|
|