|
Hi,
I am using Dialogbar in my application, but i can't resize my dialogbar. It appears in bottom side.
below see my code
if(!m_wndBottomBar.Create(this,IDD_ALM_BOTTOM,CBRS_BOTTOM | WS_VISIBLE|WS_CHILD|CBRS_LEFT|CBRS_SIZE_DYNAMIC ,IDD_ALM_BOTTOM))
{
TRACE0("Failed to create dialog bar\n");
return -1;
}
m_wndBottomBar.SetBarStyle(m_wndBottomBar.GetBarStyle()|CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
m_wndBottomBar.EnableDocking(CBRS_ALIGN_ANY);
I have to resize bottom dialog bar any other way to resize my dialog bar?
Please help me ASAP.
|
|
|
|
|
|
Hi,
I am have C++ files (.h, .cpp) that include functions to read a specify file type (.dgn). And I want to use these functions in C# for the same purpose . I am intending use "__declspec(dllexport)" to use C++ functions.
But, I don't know what type in C# is similar to "typedef void *" in C++.
Please see belows is C++ codes
typedef void *DGNHandle;
DGNHandle CPL_DLL DGNOpen( const char *, int );
void CPL_DLL DGNSetOptions( DGNHandle, int );
int CPL_DLL DGNTestOpen( GByte *, int );
const DGNElementInfo CPL_DLL *DGNGetElementIndex( DGNHandle, int * );
Thanks and regards,
|
|
|
|
|
Use the following in google
"C#" interop void pointer
|
|
|
|
|
|
Hi,
Can I use the IntPtr (C#) for structure pointer (in C) ?
For example: I have a struct pointer in C: Quote: DGNElemCore * .
[StructLayout(LayoutKind.Sequential )]
public class DGNElemCore
{
public int attr_bytes;
public byte[] attr_data;
public int color;
public int complex;
public int deleted;
public int element_id;
public int graphic_group;
public int level;
public int offset;
public int properties;
public int raw_bytes;
public byte[] raw_data;
public int size;
public int style;
public int stype;
public int type;
public int weight;
}
|
|
|
|
|
I have already responded on the thread in the C# forum. You have changed the order of the items in this structure so it will not work.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Hi,
I have one dialog box (parent). I have a button on this dialog box. On clicking this button I'll invoke second dialog (child) (modal dialog). Now I want to keep track of an instance in child dialog that it has been invoked second time. I mean to say when I click on the button, this dialog will be Poped Up. Now in any of the functions defined in the child dialog, I want to know that this dialog has been invoked second time and also I want to save the state of any variable defined in the child dialog. for example if I have set a variable as 1 in child dialog, Now when I invoked this dialog second time, I should get the variable's value as 1.
Anybody have any idea regarding this.
Any help will be appreciated.
Regards,
Mbatra
|
|
|
|
|
|
what static......?
what should be kept static, the variable which I declared......
Still then how to check for the dialog invocation for second time.?
Please explain, or help with some sample code.
Regards,
mbatra
|
|
|
|
|
You have three options:
1. Store the information in static member variables in the child dialog.
2. Store the information in member variables of the parent dialog, pass it to the child dialog before calling DoModal() and retrieve the information when DoModal() returns.
3. Store the information in the registry below your application key. This is usefull when settings should be re-used when starting your app the next time. Information that is only used during the app execution time (e.g. the counter) should not be stored in the registry. But you may use a combination of registry with option 1. or 2.
|
|
|
|
|
Agree with some of other post, there is one more solutions, create a data class in your parent dialog class and pass as reference everytime the child dialog is invoked and all data modification should be done with the reference object, this way you will not have declare anything static and data would be at one place only!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
You should keep a member variable(integer type)as static in parent dialog class. when button in parent dialog is clicked, this variable value just increment. i mean keep this variable as a counter. when this counter value is greater than one, pass this value to child dialog class. there should be checking for this counter value.
Note: in child dialog, you should use a configuration file(.INI) or text file for storing variable value.this file updated when closing the child dialog. if counter value is greater than 1, you should read this value from file and update variables.
modified 20-Oct-12 5:04am.
|
|
|
|
|
I have an image of a form. I can easily add that image as a bitmap
resource. Then in my CFormView, I click on Toolbox and Picture Control and
I select Bitmap as the type and find the image from the list of images. I
can then lay edit boxes on top of the form.
The problem is, the form is just a black and white form and the bitmap takes
up alot of space. I have several form images to add and my program is becoming
really big in size. In contrast, a png or jpeg is alot smaller in size and the
final software will be smaller.
I can add a PNG as a resource. However, I click on Toolbox and add a Picture
Control and then right click on that Picture Control to go to its properties
and if I select Bitmap, it doesnt show the PNG as a image to select. How can
I use the PNG that is added?
Another question which is not crucial. How can I add a JPG as a resource? And
if I add it, how can I then use it?
If you can show me how to use a PNG or JPG or anything similar (not a GIF) and
how to make it display, that would be great.
Sincerely,
Danielle Brina
|
|
|
|
|
If you can use GdiPlus library, Gdiplus::Bitmap can be used to load png and jpeg images.
You need to copy RGB data from jpg or png file to your picture control.
Please Note: GDI+ initialisation is required at startup of the application.
Gdiplus::GdiplusStartupInput gdiplusStartupInput;
Gdiplus::GdiplusStartup(&m_gdiplusToken, &gdiplusStartupInput, NULL);
Gdiplus::Bitmap::FromStream() can be uised to create Bitmap from resource data.
Loading JPG & PNG resources using GDI+[^]
modified 19-Oct-12 4:01am.
|
|
|
|
|
I am attempting to call an x86 assembly procedure that takes three parameters, and returns the third parameter to the caller. The following is a simple example of a 3-parameter fastcall attempt:
@Foo@12 PROC
POP EAX, [ESP]
RET
@Foo@12 ENDP
And the C++ code that calls it:
#include <iostream>
using namespace std;
extern "C" int __fastcall Foo(int, int, int);
int main(int argc, const char *argv[]) {
cout << Foo(1, 2, 3);
cin.get();
return 0;
}
It is my understanding that the first two parameters are passed in ECX and EDX, respectively, and the remaining parameters are pushed on the stack. The problem is that the return address appears to be pushed to the stack AFTER the third parameter. So with the code above, EAX is populated with the return address, and then I get a memory access error trying to read address 3.
The only way I have been able to get this to work, is to change my assembly to the following:
@Foo@12 PROC
POP EDX
MOV EAX, [ESP]
MOV [ESP], EDX
RET
@Foo@12 ENDP
Now my simple, one assembly instruction code tripled in complexity. My question: is there some way to force VS2010 to push the return address BEFORE the method parameters, so my first, single-instruction assembly method works as expected? Alternatively, it would also be acceptable if VS2010 took responsibility for pop-ing the third input parameter off the stack (currently, if I don't call POP exactly once, I get a stack corruption error when main exits). In either case, there must be a way to write this method using fastcall calling conventions such that it only takes a single assembly instruction. Thanks for any help!
-- EDIT --
In case anyone cares, the answer is:
@Foo@12 PROC
MOV EAX, [ESP+4]
RET 4
@Foo@12 ENDP
Sounds like somebody's got a case of the Mondays
-Jeff
modified 23-Oct-12 18:45pm.
|
|
|
|
|
I'm not sure where you got your information but as far as I know, all arguments are pushed onto the stack when calling any function from C/C++. This MSDN page[^] would seem to confirm that.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
On the page you quoted, it says "C and C++ function arguments are usually passed on the stack". This is if you are using the cdecl or stdcall calling conventions (all arguments are pushed to the stack, but they vary in who is responsible for clean-up). I am attempting to use the fastcall calling convention, where the first two parameters are passed in ECX and EDX, respectively, and all remaining parameters are pushed to the stack right-to-left. Confirmation of this can be found on MSDN[^]
When I actually run in the debugger, the stack pointer register (ESP) is pointing to the return value (pushed from EIP, the program execution pointer, after my third parameter is pushed), with [ESP + 4] (the second item in the stack) being my third parameter. When using fastcall, the callee is responsible for removing the parameters from the stack. However, I currently have to swap the two arguments on the stack (at addresses [ESP] and [ESP + 4]), otherwise I pop the return address off the stack, then try to return to address 3 when the RET statement executes.
This seems counter-intuitive to me. Why should I have to swap the stack arguments? Is there some other way to do this where I don't have to swap the arguments?
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
If you create a dummy function in C with the __fastcall attribute and compile it with the /FAs compiler options, you can see how the C compiler generates the code for such a call. If you ignore the fact that the C generated code moves the parameters around quite a bit, you can see that it does not pop the arguments off the stack, but addresses them directly by their offset relative to the stack pointer. It then clears the pushed arguments by using the ret N return command.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
This may be a wrong place to post this request,my apology.
I am currently using a USB dongle called LittleWire as a control interface to I2C device.
I am trying to learn how to build libraries and so far I pretty much stuck with morass of header files.
I can build simple Static library ( in VC ) , but it appears that “outside MS” developers rely heavily on variety of Make /Cmake tools.
My obviously obsolete programming book "Inside Visual C++” does not cover Make.
I have never used VC Make wizard and would like to learn how to do that.
I would greatly appreciate any personall recomendations, links/ references, on “ using Make”.
( Yes I can Google, I am looking for a real experience recomendation )
Thanks for your time.
Cheers Vaclav
|
|
|
|
|
The first question I would pose to you, is why you think you need make rather than the Microsoft tools? If you are clear that make is the only way to go then I would recommend looking at the GNU manual[^], which explains it all. But be prepared for a lot of reading and re-reading; make is great when it works but it does take some getting used to.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
I did find some material to study and the first thing that jumped out was “it is a cross-platform tool”.
Being a MS “developer” I definitely do not need that. I was just looking to see if I can adopt the open source libraries without having to copy all the source files to VC library projects. Looks like I would not gain any better organization / directory structure than what VC creates.
At this point I agree with you, but still like to learn how to use “Makefile” project wizard in VC.
I am also not sure if either MS or other vendors results of “Male” can be debugged at the source level.
I have found few libraries I just cannot use wiht my archaic VC and just do not like to be blindfolded and not be able to get to the source level.
|
|
|
|
|
Vaclav_Sal wrote: I did find some material to study and the first thing that jumped
out was “it is a cross-platform tool”.
Make is just about as cross-platform as mark-up is cross-browser.
Correct me if I'm wrong, but doesn't VS allow you to import a makefile and it will create a VS specific project file for you? Perhaps at one time it did, but now no longer.
Chris Meech
I am Canadian. [heard in a local bar]
In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]
posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]
|
|
|
|
|
Chris Meech wrote: Make is just about as cross-platform as mark-up is cross-browser. The voice of bitter experience.
Chris Meech wrote: doesn't VS allow you to import a makefile I have not succeeded in doing this with any other than those that were generated by VS in the first place.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Vaclav_Sal wrote: I am also not sure if either MS or other vendors results of “Male” can be debugged at the source level. Sure they can, Make is just a tool (like msbuild) that automates the compile and link phases of a project. It is your choice as to how much debug information is generated within those operations by the use of compiler and linker switches.
One of these days I'm going to think of a really clever signature.
|
|
|
|