|
I did get it to work. The trick I found was that I had to hide the radio buttons, make the change then show the radio buttons using the ShowWindow function. I don't know why it didn't work otherwise, it should have. It works for the initial setting of the buttons, but it just doesn't seem to re-draw them correctly after that.
|
|
|
|
|
You're correct! It should have worked. It sounds like you have some other problem that you have yet to discover.
In any case maybe you should just try invalidating the radio buttons (or window), instead of hiding and then showing the window. Just a suggestion, since you probably already tried that.
Good Luck!
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
This is a little difficult to explain. I created a dll in .NET using C# and I need to call this dll from a Visual C++ 6.0 application. I read numerous materials on setting the C# dll up with COM Interop and I think I have it working. Now for the difficult part: when I call the function to launch the UI in the C# dll, it comes up, then I do my thing and close it down. I then go through the functionality again and the dll is called w/ no problems, the form comes up, etc. When I close it down, I will get a GPF. In trying to trace the problem, it returns from my dll, then returns from my function in the 6.0 c++ application, and returns from another function. I cannot discover where the GPF is occurring. Here is a basic outline of my 6.0 c++ function:
void functionname
{
// Initialize COM.
HRESULT hr = CoInitialize(NULL);
// Create the interface pointer.
IManageInterfacePtr pIInterface(__uuidof(ManagerInterface));
// Call the Add method.
pIInterface->LaunchRSSDLL(string, string, string);
pIInterface->Dispose(); <--this is from trying something with the C# dll
pIInterface->Release();
// Uninitialize COM.
CoUninitialize();
}
I have put try/catch inside this function, around the call to this function, inside my C# DLL COM interface, and I still cannot find where the gpf is occurring. This is my first C# dll so be please be patient if I so kind of idiotic in describing this. Any ideas on what I may be missing? Any ideas on what I can look at?
|
|
|
|
|
I found my own answer in this article:
http://www.dotnet247.com/247reference/msgs/35/178790.aspx
I removed the line of code
System.Windows.Forms.Application.EnableVisualStyles()
and all is well.
|
|
|
|
|
I am trying to implement version control on saved objects by using the following:
IMPLEMENT_SERIAL(MyObject, CObject, VERSIONABLE_SCHEMA | 2)
void MyObject::Serialize(CArchive& ar)
{
if (ar.IsLoading()) {
int version = ar.GetObjectSchema();
switch (version){
case 1:
//load first version
break;
case 2:
// load second version
break;
default:
AfxThrowArchiveException(CArchiveException::badSchema, "AppVersion");
break;
}
}
but.. ar.GetObjectSchema(); always returns -1.
I can get the above to work if I add
CObject::Serialize(ar);
ar.SerializeClass(GetRuntimeClass());
so now ar.GetObjectSchema() will return the proper schema
but.. I already have version 1 information on disk w/o these two calls.
Did I mess up? Is there a fix?
Thanks for anyone who can help!
|
|
|
|
|
I usually avoid this overly complicated scheme in the first place and always write out a DWORD to use as my own 'version schema' as the first element of the serialized file. Just increase the DWORD each time you change the version,a nd youc an easily 'switch' on it for handling earlier versions of your files in later versions of your program. As long as you can compensate for the very first version, which did not have this value, you are okay to go on subsequent ones, where you will always write it out.
|
|
|
|
|
I came to same conclusion. It sure looked good in the examples though! Thanks!
|
|
|
|
|
This[^] series of articles may help you brew your own serialization scheme.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Thanks for the link! I am not sure how I missed these. I searched the archive on almost every key word I could think of.
|
|
|
|
|
Sadly, CP's search leaves a lot to be desired. But the quality of the articles and the community more than makes up for it.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Hi,
I want to create multithread, each thread read a file, how do write in SDK, write your suggestion.
Thank you.
regards,
Inba.
|
|
|
|
|
inbha wrote:
I want to create multithread...how do write in SDK
Use _beginthread() for this.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
It is better to use IOCP (IO completion ports) for such a task. See CreateFile and ReadFile() in the MSDN library.
John
|
|
|
|
|
Developing application: WinCE, hhp Dolphin9500.
Is there a function to set the keyboard to alphabetic?
|
|
|
|
|
Hi all,
I'm beginning the development of a context menu shell extension on windows 2000 and I have a question. I want to take different actions and build different menu entries depending on what I click, background or file. Which is best: developing two different projects, what will create two different DLLs, or develop only one project and let the ifs and elses treat the differences for me, creating only one DLL? If the second case is the ideal one, how do I differenciate between a file or a background click, for example, in the QueryContextMenu?
Thanks,
Luiz.
|
|
|
|
|
You can set the registry for directory / * file context menus to point to two different GUIDs that
both point back to the same DLL.
So you would have two different COM classes (e.g. CLSID_DirectoryContext & CLSID_FileContext) in your
DLL which would both implement the IContextMenuX, etc interfaces as necessary.
So, both being handled in one DLL is not only possible, it is pretty easy.
Iain.
|
|
|
|
|
Please help me with a segment code which can redirect the output to a file instead of using >> in the commandline. I am using c language.
oam
|
|
|
|
|
Try this:
FILE *file;
file = fopen("C:\\Progrem files\\test.txt","w");
CString output;
for(int i = 0 ; i < 10 ; i++)
{
output.Format("this is test string number %d",i);
fputs(output.GetBuffer(output.GetLenght() + 1),file);
}
fclose(file);
now,if you will open the test.txt file in your C:\Program files - guess what???
Good luck,
Eli
|
|
|
|
|
FILE *file;
E:\process.c(145) : error C2275: 'FILE' : illegal use of this type as an expression
oam
|
|
|
|
|
Have you included stdio.h ? However, if you are going to use MFC, I would construct a CFile object instead.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
yes i have included #include stdio.h Im using visual C. How can i construct a struct CFile?
oam
When opportunity knocks, open the door as it might comes once in a time
|
|
|
|
|
mpapeo wrote:
How can i construct a struct CFile?
I (erroneously) assumed you would be using MFC.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
This error may be incorrect! The code provided by eli5021979 is correct, accept that it is not competely C code. The CString is an C++ class, get rid of it. Use a char buffer in stead: char buffer[128] (whatever size you need).
The error will probably disappear.
Heck, in the example code, I would get rid of the temporary buffer and just use fprintf() instead.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
what is the loop for in the above code, i get a lot of errors. Pliz give the idea of how to write the segment code in C
oam
|
|
|
|
|
mpapeo wrote:
what is the loop for in the above code,
It executes the two statements within the curly brackets 10 times.
mpapeo wrote:
i get a lot of errors.
And those are??
mpapeo wrote:
Pliz give the idea of how to write the segment code in C
Hasn't that already been provided?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|