|
Good evening,
Trying to develop a solution the right way. I'm trying to keep this whole thing as modular as possible, so that if one application(except for the manager) goes down, no other application, including the manager is affected.
I have one application(process) that manages many resources, it is important that these resources are available 24/7. Different applications( about 20 different ones, each of which at times are taken down for modification/upgrade ) will interface with the managing application for use of the resources. The manager will tell the application that is using the resource that a specific event occured and the application will respond with next action(state machine). The manager will take the action on the resource, and send the next event to the application using the resource... until the application is done with the resource... when done with resource the manager adds it to the pool for availability.
I am presently using MSMQ for the communication. I basically send a const recognized by all concerned in the subject line, and if any data is required, I put it in the body in comma delimited format.
It seems I'm working really hard to keep this thing together. Additionally, these events/responses must be quick... I can get up to 150 a second.
How would you do it?
Thanks!
Scott!
|
|
|
|
|
I wanted to delete several classes from my project. Following procedure given about 1000 posts ago I removed the .cpp and .h files for the undesired classes from my project folder. I then deleted the .clw file, reopened my workspace and hit Ctrl+w. The Class Wizard came-up and said I had no .clw and would I like one? I said yes and .clw was rebuilt. I examined the .clw and the unwanted classes are indeed gone.
Problem is this: the deleted classes still show-up in the Class View window, and the file names of the removed files persist in the File View window. How can I cause my workspace view windows to show the updated project configuration?
I am running VS5-SP1, in the process of d'loading SP3.
Alternatively, what I am trying to do is set-up a project workspace that is hooked-up to MFC and wizards, but I want to avoid (for the time being) some of the files that AppWiz generates for me so that I can build from scratch and learn the details. I want to keep only the app class and the mainframe class.
I am a beginner at MFC and VC++, but I have solid experience in C.
Tadzu
|
|
|
|
|
Why are you d/l SP3 instead of 4 ? Are there issues I haven't heard about ?
As to your files, if they've been deleted from the folder, and also removed from the project in file view, I'd be surprised to imagine where visual c is finding out about them. There are a number of other projectname.ext files, you *could* back them all up and try deleting other files as well as the .clw and figure out where it's being stored there.
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
Problem is this: the deleted classes still show-up in the Class View window
Close the workspace, delete the project.ncb file, then reopen the workspace.
--Mike--
http://home.inreach.com/mdunn/
Is history an illusion caused by the passage of time, or is time an illusion caused by the passage of history?
|
|
|
|
|
Okay, the unwanted classes are gone, now.
Just a beginner's mistake. Turns-out that "Delete" does not show-up on the shortcut menu (right-mouse-click menu) when in File View, so I deceived myself into thinking that there was no delete option. The "Delete" option is in the edit menu of the mainframe, as Christan pointed-out.
Rereading the Environment User's Guide.
Tadzu
|
|
|
|
|
You can also just hit the delete key.
|
|
|
|
|
Hi, i am trying to do i game, and when a player wins, a message comes saying "player 1 won"
i want to reset the game, when the butten is pressed.. Is there a way i can return to the stat the game was when i first opened the program?? if so please tell me, so i dont need to close and reopen the game all the time
Thank you..
|
|
|
|
|
Hi, i am trying to do i game, and when a player wins, a message comes saying "player 1 won"
i want to reset the game, when the butten is pressed.. Is there a way i can return to the stat the game was when i first opened the program?? if so please tell me, so i dont need to close and reopen the game all the time
Thank you..
|
|
|
|
|
Yeah - it's easy. You reset all your variables ( score, player data, etc. ) and restart your main loop. The best way is to externalise your setup code into a function that gets called on startup and again when you want to restart the game.
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
Hi All,
I need to insert jpeg-file in Access database using ADO. But I can't. I tried to use IPicture & IPictureDisp but it's failed.
What should I do to insert jpeg into mdb file?
Thanks.
Happy coding,
Igor
|
|
|
|
|
I cant figure out, how to make so when i push a butten my icon or bitmap get invisibel... I know how to do it to a butten, but it dosnt work with a bitmap or icon...
I also need a litle help to make a background to my program, i would like to place a bitmap behinde all of my buttens, but it allways place over the buttens not behind.. need help
Thanks
|
|
|
|
|
To make icons/bitmaps invisible, you need to assign them an id other than IDC_STATIC in the resource editor. Then in your message handler for the button (Assuming IDC_ICON_IDENTIFIER is the identifier you gave the icon/image):
GetDlgItem(IDC_ICON_IDENTIFIER)->ShowWindow (SW_HIDE);
or
GetDlgItem(IDC_ICON_IDENTIFIER)->ShowWindow (SW_SHOW);
As for placing bitmaps behind buttons, I've never done this because it sounds ugly to me . But something like the following should do it:
GetDlgItem(IDC_BUTTON)->SetWindowPos(GetDlgItem(IDC_BITMAP), 0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);
|
|
|
|
|
I'm going out on a limb here, but I think you've misunderstood the second part of the question. I think he wants a bitmap background on his dialog.
If so, you do that in OnPaint, and you create the CBitmap from the resource, select it into a DC and Blt it over the dialog yourself.
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
Hi:
Could you please help me in how to store data from MFC application to Execel file?
meaning that I have data in integer and each one has a lable, how can I save them in to .xls files.
I'll really appriciate your help...
thank-you.
|
|
|
|
|
Does it have to be saved directly to an xls file? Things would be much easier for you if you could save it out to a Comma Seperated Values (CSV) file which could be imported into Excel. If it needs to be directly to Excel then check out
http://www.wotsit.org/download.asp?f=xls
|
|
|
|
|
Thanks for your help but could you please tell me to import a comma separated data's to Execel, Because I am not familiar with SQL and Excel files...
thank-you
|
|
|
|
|
Thanks for your help but could you please tell me to import a comma separated data's to Execel, Because I am not familiar with SQL and Excel files...
thank-you
|
|
|
|
|
There's no need to use SQL. If you create an ASCII text file like so:
Label1,Value1
Label2,Value2
and save it with a .CSV extension, you can open it up in excel directly (like it was an .XLS file). I'm pretty sure that Excel's installation sets up the CSV file types, but if it doesn't, just click on File...Open. Change the type to Text Files and open up the file.
|
|
|
|
|
that was stupid question I know, It did work very well thanks very much for the help...
|
|
|
|
|
that was stupid question I know, It did work very well thanks very much for the help...
|
|
|
|
|
that was stupid question I know, It did work very well thanks very much for the help...
|
|
|
|
|
I wish my application detect Internet Explorer's downloads (url or file). I'd like my application control information about download (for example: filename, progress etc).
How to do?
|
|
|
|
|
Create a Sink to the desired event and fire your own program to download instead
1) Get a pointer to the connection point container (IConnectionPointContainer).
2) Call the FindConnectionPoint method to find the connection point that you want. For Internet Explorer 4.0 you want the DWebBrowserEvents2 connection point interface. (Optionally, you can call EnumConnectionPoints to enumerate through all the connection points that the server supports.)
3) Advise the connection point that you want to receive events. Pass a pointer to the IUnknown interface of the event sink. Remember that the connectable object will use the IUnknown pointer to query the client for the event sink interface. Most connectable objects will return a failure code from Advise if the client does not support the event sink interface. In the case of Internet Explorer 4.0, if the client does not support the event sink interface, Internet Explorer 4.0 will then query the client for IDispatch.
4) Implement IDispatch::Invoke to handle any events that are fired.
5) When you no longer want to receive events, you can call Unadvise and pass it the cookie that you got from the call to Advise
Cheers
Alfadhly
<marquee>
whoop there it is...
|
|
|
|
|
Hey guys,
I'm new to using MFC and to programming in general. I'm having great difficulty with Using CString to read off reg_sz values from the registry.
I keep getting this Debug assertion after i leave the function i have these registry reads in
Program: MyApp
File: dbgheap.c
Line:1011
Expression:_CrltsValidHeapPinter(pUserData)
exception 03h in my MyApp.exe
heres the function snippet:
DWORD dwType =0, dwSize=256;
.........
.......
float ftemp;
for(int i=0; i<6 ;i++)
{
//open key
......
RegQueryValueEx(tempKey,"Label", NULL, &dwType,(BYTE*) RegRead.GetBuffer(256), &dwSize);
RegRead.ReleaseBuffer();
//convert string to float value
ftemp=atof(LPCTSTR(RegRead));
m_sClass->Function(i,ftemp,value);
.......
m_sClass->Function1(i,ftemp,value,value2);
}
Once i leave the function this loop is contained in, the compiler throws that degug assertion. If i remove all references to this operation i dont get the assertion. Therefore i assume im using CString wrong somehow. Am i? What is the proper way to make the registry read then?
Background:
I am trying to retrieve a float value i wrote to the registry as a REG_SZ and then use it.
This may be a stupid question but it's not to someone new at this.
I appreciate any help
"DWORD my man!"
|
|
|
|
|
I've been programming in MFC since 1994, and I never directly modify the CString buffer, it just seems wrong to me.
Why not just use a character array? What do you gain by futzing around in CString's underwear?
ie:
char buffer[256]; /* or */ char buffer = new char[dwSize];
RegQueryValueEx(tempKey,"Label", NULL, &dwType,buffer, &dwSize);
ftemp=atof(buffer);
delete buffer; // (if 'new' was used)
Having said that, I wasn't able to duplicate your error, and your use of CString seems correct. There is a very thin registry wrapper class in ATL called CRegKey. It saves you a little trouble. Here is my test of your problem, using both CRegKey and your direct api calls:
<br />
#include <stdio.h><br />
#include <afx.h><br />
#include <atlbase.h><br />
<br />
void Function1(float f)<br />
{<br />
printf("ftemp: %f\n",f);<br />
}<br />
<br />
#define USE_CREGKEY<br />
void main(int argc, char* argv[])<br />
{<br />
DWORD dwType =0, dwSize=256;<br />
float ftemp;<br />
CString RegRead;<br />
<br />
#ifdef USE_CREGKEY<br />
CRegKey myKey; <br />
LONG result = myKey.Open(HKEY_CURRENT_USER,"deleteThisKey",KEY_READ);<br />
<br />
ASSERT(result == ERROR_SUCCESS);<br />
<br />
for(int i=0; i<6 ;i++)<br />
{<br />
result = myKey.QueryValue(RegRead.GetBuffer(dwSize), "Label", &dwSize );<br />
ASSERT(result == ERROR_SUCCESS);<br />
RegRead.ReleaseBuffer();<br />
<br />
ftemp=(float)atof(LPCTSTR(RegRead));<br />
<br />
}<br />
<br />
#else<br />
HKEY tempKey;<br />
RegOpenKeyEx(<br />
HKEY_CURRENT_USER,
"deleteThisKey",
0,
KEY_READ,
&tempKey
);<br />
<br />
for(int i=0; i<6 ;i++)<br />
{<br />
<br />
::RegQueryValueEx(tempKey,"Label", NULL, &dwType,(BYTE*) RegRead.GetBuffer(256), &dwSize);<br />
RegRead.ReleaseBuffer();<br />
<br />
ftemp=(float)atof(LPCTSTR(RegRead));<br />
<br />
}<br />
#endif <br />
<br />
Function1(ftemp);<br />
}<br />
When I use the registry, I like to use Sam Blackburn's WFC utility classes. He has a CString aware class called CRegistry that should be included in MFC. Even if you don't use the classes, Sam has done a super job of giving us great windows/MFC code to use as examples.
http://www.samblackburn.com/wfc/
I'm sorry I couldn't pinpoint your problem, but I hope this helps.
Jim
PS: Be sure you close tempKey with RegCloseKey(tempKey) when you are done with it. CRegKey does that for you.
|
|
|
|
|