Yes that is example when pragma pack's are needed. I need them when I'm reading some structure from disk file. If i would not pack it, variables in the structure would have 'byte gaps' between themselves, and structure would be read incorrectly.
mirex
Posts
-
#pragma question -
regarding MSVC debuggerTo me is mystery why did it compiled, because in class C you try to override fun(), even though you should not be able, because it is already overriden in class B and its not virtual anymore. I cant help you about the rest, because MSVC does not show pointers to funcs to me at all.
-
about breakpoints in VC++Try rebuilding the project. Or just ignore it and run program further by pressing F5.
-
Converting char to int and int to charif number is only one digit then its simple. char c = '3'; // char => int int i = c - '0'; // int => char c = '0' + i;
-
Variables and functions in user defined functionsWell definately you should not declare those variables, they should be declared (and inserted into sourcecode) when you create them by wizard. I dont use VC.NET, just a classical VC 6, but it works this way: I have main dialog, it is a class, it has two sourcefiles, header classfile.h and code classfile.cpp. When I insert a button and add a function to it it creates a function (OnButton1 for example) which is member of the dialog class (it is defined in header and function code outline is inserted into cpp file). If i create a edit box and associate a variable to it its definition is added to header file. (are you sure you added it ? because if you add it and then click 'cancel' button, then changes are lost, you have to click 'Ok' button in the wizard). So now we have a function which is member of dialog class and a variables which are members of the dialog class. So they should see each other and they should be able to access each other... if this does not help then please post a build log or project files, where we can see what is the error.
-
Variables and functions in user defined functionsplease rephrase your question, i dont understand
-
how to fill a combobox with datatadapterWhat do you mean by data adapter ? You can populate combobox easily and set their data by: i = CComboBox::AddString( "your string" ); // function returns index of item CComboBox::SetItemData( i, int_key_value ); // set the data then retrieving the selected item: i = CComboBox::GetCurSel(); // returns index of selected item v = CComboBox::GetItemData( i ); // returns item's data
-
How to do oldschool graphics in winHi guys, Im working on an old-skool project which should be game in 0x13 Dos resolution which was 320 x 200, 256 colours, paletized. Can anyone tell me how it is possible to use this mode in windows (in VC++)? Initializing was done easily and probably will be no problem, but drawing in this mode was done through direct memory access to 0xA000:0000 which will windows probably block in win app. Or, is there any other way how to use paletized colour mode like this ? thanks
-
How to compile .exe without trash ?Thank you ... Im not using Dao so I hope that last part of code does not apply to me. And I though that all asserts are turned off in Release version (through #ifdef _DEBUG) ... sigh, so looks like its hopeless
-
How to compile .exe without trash ?Yup 'debug info' was set to 'none' Of course im not using "static char s_FilePath[] = __FILE__;" that would be pretty dumb :) why would I need absolute path to my project in the proggy :) generally absolute paths are bad thing. Uh oh then ...
-
How to compile .exe without trash ?Thank you, but actually it didnt, because all those things were like that from the start, those are default Release settings. :(
-
how to hide "main dialog" properly?When you create dialog you specify its style, and one of the styles is if the window is shown or hidden. Remove shown flag. Use this if you create dialog through CDialog::Create() If you created dialog in Resource editor then doubleclickit to change its properties, and turn off Visible property.
-
How to make a ClistCtrl has a gridline look?maybe LVS_REPORT has to be set through ClistCtrl::SetStyle( LVS_REPORT ); and then try setting ClistCtrl::SetExtendedStyle( GetExtendedStyle() | LVS_EX_GRIDLINES ); i think that LVS_EX_... means Extended style, and can be set only through SetExtendedStyle()
-
How to compile .exe without trash ?Yup I view it with hexviewer, but i bet it is visible with notepad too :) Yea you can crack programs by hexviewers, but disassemblers / hexview+dissaembler (like HIEW or DN) are better, trust me. But anyhow, question is how to compile without the trash ? Now anyone can see my developement directories, and it grows my .exe too much. Is there some compiler switch or something ?
-
How to compile .exe without trash ?When I compile any of mine projects with MS Visual C++ 6.0 there is alot of trash inside .exe file. Its looking like debug information although I'm building a release version (there are lots paths and filenames inside executable clearly viewable). How to remove it all, to reduce .exe size ? Why is it there ?
-
Show dialog in taskbar?I have same problem, all subdialogs of my dialog don't show in taskbar ... they are all normal CDialogs. Maybe it could be solved by creating them with parent NULL, or DesktopWindow
-
I'm floating integer to hex?depends how do you want to convert it to hex ... you know usually only ints are converted to hexes ... floating part is not carried over. You could do printf( "%X", (int) t ); to print it in hex, but it will print only integer part. If you want to print its binary representation you could do printf( "%08X", *((long*) &t) );
-
Regarding Immovable windowYou could also remove caption of the window if possible ... if window has no caption then users do not have anything to move it.
-
I need helpEdit box in which you enter the string should have an property function OnEdit or OnChange, which is called everytime when string is changed. Override this function and inside it call UpdateData(); which should update string variable to its current status.
-
how to use a lib file?might be also that .lib is not included :) check lib path.