|
if you have a class Dialog you can use
<br />
riporto * dlg;<br />
dlg = new riporto();<br />
dlg->create(IDD_RIPORTO);<br />
dlg->ShowWindow(1); <br />
whitesky
|
|
|
|
|
Desmo16 wrote: temp->Create(IDD_RIPORTO,this);
Move the call to Create() to the constructor:
riporto::riporto( CWnd* pParent ) : CDialog(riporto::IDD, pParent)
{
Create(IDD);
} Now you can create and display the dialog via:
riporto *pDlg = new riporto;
pDlg->ShowWindow(SW_SHOW);
...
pDlg->DestroyWindow(); Desmo16 wrote: the application runs but crashes at runtime
Have you narrowed the "crash" down to a single statement?
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
i've got a trouble calling Create()
the error is:
"riporto::Create": impossible converting parameter 1 from "int" to "LPCTSTR"
|
|
|
|
|
I have a function in cpp file returning int * array and taking int * array as a parameter. It is as:
int * funcArg(int *a ) {
int DLLArg [] = {100,200,300};
a=DLLArg;
return a;
};
I have exported this function in the dll (i have checked it with dumpbin.exe)
But I can not handle this function in c# client. My code in c# is as: ( ıt gives this error. "An unhandled exception of type 'System.Runtime.InteropServices.SafeArrayRankMismatchException' occurred in CSharpClient.exe
Additional information: Safe array of rank 51241 has been passed to a method expecting an array of rank 1."
What should I do? URGENT help!!!
namespace CSharpClient
{
class Class1
{
[DllImport("DenemeNonMfcDll.dll",EntryPoint="?Sub@DLLclass@@QAEHHH@Z")]
public extern static int Sub(int a, int b);
[DllImport("DenemeNonMfcDll.dll")]
[return: MarshalAs(UnmanagedType.SafeArray)]
public extern static int [] funcArg(int [] a);
public static int [] intArray = new int [3] {0,1,2} ;
static void Main(string[] args)
{
foreach (int num in funcArg(intArray) )
{
System.Console.WriteLine(num.ToString());
}
Console.WriteLine("Press any key to continue...");
Console.ReadLine();
}
}
}
|
|
|
|
|
You are trying to return a pointer to an array on the stack. There is no guarantee that your array will still be there when your function returns. You are passing in a parameter "int *a" which you never use.
Was this your intention?
int * funcArg(int *a)
{
a[0] = 100;
a[1] = 200;
a[2] = 300;
return a;
};
Most people usually have another parameter for the calling function to tell the callee the size of the array being passed so the callee won't exceed the buffer.
|
|
|
|
|
My aim is to write a function returning int array and taking an int array as a parameter such as
int * funcArg(int *a){
return a;
};
I will export it from c++ dll and I will use this function in c#. I will call it like
[DllImport("DenemeNonMfcDll.dll")]
[return: MarshalAs(UnmanagedType.SafeArray)]
public extern static int [] funcArg(int [] a);
But C# can not handle it this way. And I coul not find a way doing this. Either I can change c++ code or c# code. But I could not find a solution to make an interoperation between c++ and c#
|
|
|
|
|
|
Remove the default border if necessary
OnPaint, or in OnEraseBkgnd draw a line
SaRath.
"Where I am from, there is no plan B. So, take advantage of today becuase tomorrow is not promised. - 50 Cent"
<blink>My Blog | Understanding State Patte
|
|
|
|
|
i dont know how to remove and how to add so can u send me code for this
thanks
Ashish Dogra
MCA
Noida
|
|
|
|
|
Right click on a dialog box while in design mode and see if a menu pops up. If it does so, then see what is there with it. Nobody will *send* you the code for anything. You may have to code and when you run into trouble someone can help you.
You have an apple and me too. We exchange those and We have an apple each.
You have an idea and me too. We exchange those and We have two ideas each.
|
|
|
|
|
You can use ModifyStyle function to remove or add a window style and ModifyStyleEx for add/remove extended style.
for removing border, ModifyStyle(WS_BORDER,0);
for removing caption ModifyStyle(WS_CAPTION,0);
SaRath.
"Where I am from, there is no plan B. So, take advantage of today becuase tomorrow is not promised. - 50 Cent"
<blink>My Blog | Understanding State Patte
|
|
|
|
|
thanks for your reply
but can you tell me how can i add at the bottom of dialog box as in the Windows XP and i want to add some button on it
and with ModifyStyle(WS_BORDER,0); the dialog box upper bar willbe inactive but not disappear
thanks
Ashish Dogra
MCA
Noida
|
|
|
|
|
check MSDN for more details about windows styles.
in the OnPaint function,
CPen pen;
pen.CreatePen(PS_SOLID,GetSystemMetrics(SM_CXDLGFRAME),GetSysColor(COLOR_ACTIVEBORDER));
dc.SelectObject(pen);
CRect rect;
GetClientRect(rect);
dc.MoveTo(dsierd_x_pos,desired_y_pos);
dc.LineTo(xpos,ypos);
do the necessary claculation to draw your line
SaRath.
"Where I am from, there is no plan B. So, take advantage of today becuase tomorrow is not promised. - 50 Cent"
<blink>My Blog | Understanding State Patte
|
|
|
|
|
What do you need exactly? if you answer to me then you dont need to asked this question everyday
whitesky
|
|
|
|
|
I think he needs something like a toolbar / dialogbar that docks at the bottom.
|
|
|
|
|
he asked this question yesterday and i guess he needs to irregular window
whitesky
|
|
|
|
|
yes sir i want same as you understand the dialogbar/toolbar
and i want to place button on that
Ashish Dogra
MCA
Noida
-- modified at 4:23 Friday 7th July, 2006
|
|
|
|
|
1) Insert a dialog bar resource
2) Create a CDialogBar object in your CMainFrame class
3) Inside CMainFrame::OnCreate(...) , create your dialog bar as below
if(m_wndDialogBar.Create(this, IDD_DIALOGBAR, WS_CHILD | WS_VISIBLE | CBRS_BOTTOM, IDD_DIALOGBAR) == false)
return -1;
...
m_wndDialogBar.EnableDocking(CBRS_ALIGN_BOTTOM);
...
DockControlBar(&m_wndDialogBar);
|
|
|
|
|
thanks sir
but i am using Dialog based in mfc not SDI
and sir i want to add dialob bar at the bottom and remove it from dialog's upper side
thanks
Ashish Dogra
MCA
Noida
|
|
|
|
|
ashish dogra wrote: remove it from dialog's upper side
If by upper side you mean the title bar, you can just remove it in the Title bar property of your dialog
ashish dogra wrote: but i am using Dialog based in mfc not SDI
Isn't that easier? If you want it to look like a dialog bar at the bottom, just drag a group box control and place it at the bottom. Modify the styles if you need to. Now place your buttons or whatever in it. Doesn't it look like a dialog bar now?
|
|
|
|
|
thanks sir
can i change the color of groupbox with ctlcolor function
tellme and if i change this then tell me what i can write on GROUPBOX
if(nCtlColor == CTLCOLOR_GROUPBOX )
{
hbr=CreateSolidBrush(RGB(0,100,0));
pDC->SetTextColor(RGB(0,0,255));
pDC->SetBkColor(RGB(0,100,0));
}
Ashish Dogra
MCA
Noida
|
|
|
|
|
If you wanna do all these color customization, i suggest you create a class derived from CStatic and do it in there. Then in your dialog, place a static control and subclass it with the class you just created.
|
|
|
|
|
thanks a lot
Ashish Dogra
MCA
Noida
|
|
|
|
|
one another question and i answerd use SetWindowText and save previous values
Did you saw my message yesterday
whitesky
|
|
|
|
|
WhiteSky wrote: Did you saw my message yesterday
Sorry, dont think so.
|
|
|
|