|
Hi !
My question is about VC++ 6.0 evnironment.
I want to write an pure Assembler programs using ml.exe which I get through Service Pack 5 & Processor Pack.
------------------------------
Well I know how to create a console application(link options /SUBSYSTEM:CONSOLE and /ENTRY:mainCRTStartup is used), that requires MASM (ml.exe) to assemble SOME of its *asm files.
In this case I use custom build for these *asm files for example:
ml.exe -c -coff -Cx -Fo$(IntDir)\$(InputName).obj $(InputName).asm.
--------------------------------------
But I don't know how to create PROJECT which
consist of only assembler source files(/SUBSYSTEM:? /ENTRY:?).
May be using some Custom Wizard, but ... I don't know !
Is there anyone who can help me ?
Code Red
|
|
|
|
|
doesnt work like that... use other environment!
Don't try it, just do it!
|
|
|
|
|
How do you get the address of a method? I know how to declare a method pointer and use that, so I'm not totally lost.
But what I want to do is to cast the damn thing into a void pointer for later use in some ASM magic.
What I want to do is this:
void* ptr = (void*)&Class::Method but the compiler just won't let me cast it to a void*.
--
Stukas! Stukas im Visier!
|
|
|
|
|
|
I've tried that as well but to no avail.
--
Stukas! Stukas im Visier!
|
|
|
|
|
I just slipped on the keyboard and typed this: void* method = (void)Class::Method; . Notice the absent * in the cast operator? The compiler accepted it and left method uninitialized (0xcccccccc). Who smoked what, when and how in the Microsoft C++ compiler team?
--
Stukas! Stukas im Visier!
|
|
|
|
|
Jörgen Sigvardsson wrote:
Who smoked what, when and how in the Microsoft C++ compiler team?
ooo, that's sig material
That's really funny (in a sarcastic way) - assigning a void quantity to a void* is allowed. I guess the "anything can be implicitly converted to void* " rule really applies to anything, even nothing.
--Mike--
Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
CP SearchBar v2.0.2 released
|
|
|
|
|
I solved it.
void* ptr;
__asm push Class::Method
__asm pop ptr
I am evil. :cackle:
--
Stukas! Stukas im Visier!
|
|
|
|
|
Can you not simply use:
DWORD dwAddress = Class::Method;
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Nope. C++ is very picky about method pointer types it seems. Ordinary function pointers you can cast into float if you wish, but not method pointers.
It seems, __asm is the only way
--
Stukas! Stukas im Visier!
|
|
|
|
|
I have 2 arrays and I need to display data this way:
array1 array2
data1 data1
data2 data2
data3 data3
How do I dot this?
|
|
|
|
|
for (int x = 0; x < 2; x++)
cout << array1[x] << ' ' << array2[x] << endl;
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
IT depends - if you know they are the same length, and know what that length is, you can do this (using "cout" as an example, you can use print, or do it to a list box, or whatever.)
cout << "Array 1\t\tArray 2" << endl;
for(int i = 0; i < sizeOfArrays; i++)
{
cout << array1[i] << "\t\t" << array2[i] << endl;
}
Now, if your array sizes are different, it's tricker. You either need array classes (e.g., CArray or stl::vector), or variables specifying the size of each array, and then in the for loop, check to make sure you're not out of bounds, e.g. (assuming array1 and array2 are STL vectors):
cout << "Array 1\t\tArray 2" << endl;
int arraySize = array1.size();
if(array2.size() > arraySize)
arraySize = array2.size();
for(int i = 0; i < arraySize; i++)
{
if(i < array1.size())
cout << array1[i] << "\t\t";
else
cout << "(null)\t\t";
if(i < array2.size())
cout << array2[i] << endl;
else
cout << "(null)" << endl;
}
You can tweak the formatting as necessary.
If your nose runs and your feet smell, then you're built upside down.
|
|
|
|
|
The size of the array is the same, because I am using the parallel array.
|
|
|
|
|
Ugh, this smells like homework.
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
OleLoadPicture() is currently refusing to load a JPEG file created in Adobe Photoshop 7.0, it returns E_FAIL. From looking at documents on the format of JPEG files I have determined that the signature is not standard but the file is a JPEG of some variety. The correct signature does exist about 300 bytes into the file and if I ignore everything before the signature the image will load but the rendered results are not correct. The image will load in both Paint and the Windows XP image viewer so I'm happy the image itself is ok.
Does anybody have any suggestions as to why OleLoadPicture() fails?
Systems AXIS Ltd - Software for Business ...
|
|
|
|
|
Hi guys
I'm trying to understand how it works serialization in Doc/View architecture
I have a view with some controls associated to booleans.
When I do a Open File I want to read the booleans from the file and then update the view.
I've tried to Serialize in Doc and then Update in OnUpdate in View but the controls are not refreshed. What is the correct order to do these things?
I'm doing something wrong?
Best Regards
Dr.Pi
|
|
|
|
|
Do you have something like:
class CMyDoc : public CDocument
{
public:
bool bValue1;
bool bValue2;
};
void CMyDoc::Serialize(CArchive& ar)
{
if (ar.IsStoring())
{
ar << bValue1;
ar << bValue2;
}
else
{
ar >> bValue1;
ar >> bValue2;
}
}
void CMyView::OnUpdate( CView* pSender, LPARAM lHint, CObject* pHint )
{
CMyDoc *pDoc;
pDoc = GetDocument();
m_xbReady.SetCheck(true == pDoc->bValue1);
m_xbMixed.SetCheck(true == pDoc->bValue2);
}
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Hi David
If I have to serialize a CArray variable how I have to implement in Serialize?
Best Regards
Dr.Pi
|
|
|
|
|
void CMyDoc::Serialize(CArchive& ar)
{
if (ar.IsStoring())
{
}
else
{
}
m_arr.Serialize(ar);
}
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
I am not sure the application, but let me try to give an example from what I've done.
First you must open the file where you serialized the data, here is a sample serialize code...
I would advice that if these are settings for the view and in no way have anything to do with the document data, then do not store the values in your document. Rather create a new file called ViewSettings.dat and save the values in that. Lets say ViewSettings.dat is in your c:\\Program Files\\Program folder. Where Program is your program In the sample below we will assume that bEnableWindow is the variable you wish to serialize.
in CView's OnInitialUpdate call the serialize function passing an archive of the file.. Here's how to do it.
void CView::OnInitialUpdate()
{
CView::OnInitialUpdate();
try
{
CFile fileViewSettings( _T("C:\\Program Files\\Program\\ViewSettings.dat"),
CFile::modeRead );
CArchive arViewSettings( &fileViewSettings, CArchive::load );
Serialize( arViewSettings );
}
catch (CFileException* e)
{
// if the file has not yet been created then initialize default values //
// and also create the file to where the values will be serialized.
e->Delete();
bShowVisible = TRUE;
CFile file( _T("C:\\Program Files\\EGames\\Settings\\FrameSettings.dat"), CFile::modeCreate);
// At this point we should either have set a default value for bShowVisible if the file
// had not yet been created, or if it had then we have successfully loaded it in.
myButton.EnableWindow( bEnableWindow );
}
void CView::Serialize( CArchive& ar )
{
if( ar.IsStoring() )
{
/* Save your variables
example:
ar << bEnableWindow ; Where bEnableWindow is the boolean
for enabling your control.
*/
}
else
{
/* Else load in your variable
example:
ar >> bEnableWindow ;
*/
}
}
I hope this gives you an idea! Questions?? my email is nateinstein@hotmail.com I've been doing doc view for the past year religiously and have 3 serialize functions for just one class lol.
Nathan Smith - The Essence of Art in any design is not the medium in which it is made, but the creativity of the finished product.
|
|
|
|
|
Sorry accidentally forgot to edit a paste I made, in the mode create file the path should be..
Program Files\\Program\\ViewSettings.dat"), CFile::modeCreate
Nathan Smith - The Essence of Art in any design is not the medium in which it is made, but the creativity of the finished product.
|
|
|
|
|
Serialization is evil. I'd recommend for simple stuff, just use a plain old text file or INI file. You can use CStdioFile to read in and write text files pretty easily.
If your nose runs and your feet smell, then you're built upside down.
|
|
|
|
|
|
Hi !
I have a constant which I want to use in many classes.
What I think I should do is put this constant in a header file, and include this header file in each cpp file of the classes which will be using this constant.
But, if I declare my constant like this :
const char* MY_STRING = "My string";
the linker complains that MY_STRING is already defined somewhere.
If I declare it that way :
const char MY_STRING[] = "My string";
Why is the first way not working ?
Thanks !
Jerome
|
|
|
|