|
Thank you Dominik, but yours ideas don't work in my application.
In the first case, I get an assertion in afxwin1.inl
<br />
if (!m_wndLayersDlgBar.Create(this, IDD_LAYERS, CBRS_LEFT|CBRS_TOOLTIPS|CBRS_FLYBY|CBRS_SIZE_DYNAMIC, IDD_LAYERS))<br />
{<br />
TRACE0("Failed to create DlgBar\n");<br />
return -1;
}<br />
<br />
m_wndLayersDlgBar.EnableDocking(0);<br />
m_wndLayersDlgBar.SetWindowText("Gestionnaire de calques");<br />
FloatControlBar(&m_wndLayersDlgBar, g_ptWindowLayersOffset);<br />
<br />
<br />
CMenu* pMenu = m_wndLayersDlgBar.GetMenu();<br />
pMenu->RemoveMenu(SC_CLOSE, MF_BYCOMMAND);
wndLayersDlgBar is a CLayersDlgBar which is a CDialogBar
And with the second case, i've put the correct method in my class but the program never go in this method, even when I close the entire application.
<br />
void CLayersDlgBar::OnSysCommand(UINT nID, LPARAM lParam)<br />
{<br />
CDialogBar::OnSysCommand(nID, lParam);
}<br />
Any idea ?
|
|
|
|
|
Add MF_GRAYED to function ModifyMenu().
ModifyMenu(SC_CLOSE, MF_BYCOMMAND | MF_GRAYED);
Kuphryn
|
|
|
|
|
I finally find it!
http://www.codeguru.com/mfc/comments/11651.shtml
|
|
|
|
|
hi Im new to programming - Im enrolled in gameinstitute.com taking the intro to c++
We worked with a sample that converted celsius to fahrenheit and I played with it successfully to make it do the reverse (which may seem teeny but sure felt good when I got it hehe)
Now Im trying to add a loop that will convert the answer into increments of 1-5 degrees higher and lower.
The text / class didnt really cover how to work with a loop when the start point of the loop is always different? Im not even sure if that would be right to say this way - how do i insert a loop with a variable of a float?
the code that produces the answer is :
float Fahrenheit2Celsius(float celsius)
{
return celsius * (9.0f / 5.0f) + 32.0f;
}
//celsius = (fahrenheit-32)*(5/9);
//fahrenheit = celsius*(9/5) + 32;
void DisplayOutput(float f, float c)
{
cout << f << " degrees Celsius is " << c << " Celisus" << endl;
}
Im really lost as to how to use a loop to do the requested outcome: the result with 5 degrees higher listed and 5 lower listed
the loop code thats shown in my text for a for loop is :
for (int i=0; i<10; i++)
{
cout<
|
|
|
|
|
I'm not sure how you want your output to look, but I recommend you keep reading about loops. There are 3 types: for , while , and do-while . The for loop is just a fancy while loop, designed to make it convenient to initialize a variable, check if it has reached a certain value, use it (inside the loop), and then increment/decrement its value. For your case, a while loop may be more appropriate.
Regards,
Alvaro
When birds fly in the right formation, they need only exert half the effort. Even in nature, teamwork results in collective laziness. -- despair.com
|
|
|
|
|
try this:
float deg_f = YourInitialValue - 5.0;
float final_value = YourInitialValue + 5.0;
do
{
DisplayOutput(deg_f, Fahrenheit2Celsius(deg_f));
deg_f += 1.0;
} while(deg_f < final_value);
Hope that helps.
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
I am adding a class called CImageButton derived from CButton (from CP) to my project. Whne I put a btn on the formview I want the class wizard to give me two choices for type: normal CButon, or the newly added CImageButton. I have a #include for the .h of the added class. But when I go to make a variable for a normal button, it doesnt give me the two choices.
However in the CP demo, they have the button stuff in the grey areas which class wizard works in, and all the necessary tie ins are done etc. So I dont think I can just go and fiddle with the code in the gray area. Right now it reads CButton b1, but I need it to be CImageButton b1; and it should respond just like a regular button on clicking etc...
Appreciate your help,
ns
In the CP demo the class wzd does give me two choices for button type, but if I make a new prj with the two src files in it, it doesnt....
|
|
|
|
|
I think you could try to delete (or change name, it's better ) the .clw file from your project (info for class Wizzard). So, when you open class wizzard again, it won't find the file and ask you to rebuild it from files. Say yes and you will have the choice to select the files from wich it will be build. Don't forget to also select the header and .cpp files from your class !
This should work!
|
|
|
|
|
Hi,
I have seen several code samples for how to setCheckedItems, but I can't seem to find how to getCheckedItems().
This is my setChecked function:
void CMainFrame::SetChecked(int boxNumber, BOOL val)
{
char set = 0;
if( val )
set = 1;
this->m_szChecked[ boxNumber ] = set;
}
Please let me know you know anything about this.
I would appreciate it.
|
|
|
|
|
Does anyone have any idea in ADO how to recover a dropped oracle connection, i have tried every possible combination of disconnect - connect i can think of, I am using oracle 8i, with ado 2.6. If my app is restarted the connection comes back without any problems. Any insights on what it takes to get that connection back???
|
|
|
|
|
I'm not sure why you can't reconnect. What you're doing should probably work...
However, I recommend you take advantage of ADO's connection pooling to make better use of your connection accross different apps, web pages, etc. In such a case, every time you need to run a query (or a series of queries), you open the connection, run the query, and close the connection immediately. If you use this scheme, you'll never have to worry about your connection timing out or being dropped.
Another option is to change the timeout period of your connection to a much larger interval of time. This basically just delays when the problem occurs, rather than getting rid of it, so it's not a really a good solution.
I wish I had an answer to your problem, but you may want to spend a little time trying out the connection pool scheme. It requires that you write a little bit more code, but in the long run it's a better way to share limited resources, such as database connections.
Regards,
Alvaro
When birds fly in the right formation, they need only exert half the effort. Even in nature, teamwork results in collective laziness. -- despair.com
|
|
|
|
|
Connection Pooling is in use but thank you for the suggestion
|
|
|
|
|
Does anyone have any idea in ADO how to recover a dropped oracle connection, i have tried every possible combination of disconnect - connect i can think of, I am using oracle 8i, with ado 2.6. If my app is restarted the connection comes back without any problems. Any insights on what it takes to get that connection back???
|
|
|
|
|
Hi again!!!!
I need to make a performanted and easy ServerSocket Class (TPC). I was using NDK, which work very good. But I need to recive only String messages from other application, and NDKServer only work with CMessages. IT is a problem.
what recommend to me? Exist any easy class?
el hombre arriesga su vida cada vez que elige y eso es lo que lo hace libre
|
|
|
|
|
I had the same problem, but dont give up: when i searched for "win32 socket" i found some really great help, now i am programming my own network class (without mfc). The main problem to solve this is to know that you need a threaded win32 network class. so first you have to write a class for win32 threads (you may find some code here). Next step is to look how tcp/ip works. Then you have to choose if you use udp or not.
Then the rest is easy.
good look !
sendel
PS: keep your eyes open because if my class is ready I may add it here for free use
|
|
|
|
|
Thanks very much Sendel.... I´ll wait for your class, I usually use TCP.
So if you can advise me (borthiry_martin@hotmail.com) i´ll be pleaced
el hombre arriesga su vida cada vez que elige y eso es lo que lo hace libre
|
|
|
|
|
Admittedly a newbie question about variants.
I'm using MSComm (an activeX object that handles serial port communications)
to communicate with a device that sends three hex bytes.
If I set input mode to binary input
example; m_comm.SetInputMode(1); //set input to binary
I get a very confused variant "oneChar":
COleVariant oneChar;
oneChar = m_comm.GetInput();
The oneChar.vt member shows "???" in the MS visual 6 IDE (it doesn't know
that it was a hex value... doesn't the data need to be propperly "stuffed"
into the variant structure by the device?... i.e. with a value and .vt
member type. What if it doesn't? How do you use MSComm with devices that
just send simple binary data?;P
If I leave input mode in character mode (default), the variant "oneChar"
thinks it's a BSTR. It must default to BSTR (How can I be sure that I'm
getting the correct value?)
|
|
|
|
|
Firstly, type the following into a watch window:
oneChar.vt,x
and look at the output. That should get you a reasonable value. If it doesn't, check that the address of oneChar looks reasonable; if not, your stack's probably been overwritten.
The debugger's automatic view of VARIANTs only understands simple variant types like VT_I4, VT_BSTR, etc. It doesn't understand compound types, such as arrays. You probably have a SAFEARRAY of BYTE in there - this would be VT_ARRAY | VT_UI1 (0x00002011). The VT_ enumerators are defined in wtypes.h.
--
Mike Dimmick
|
|
|
|
|
Thanks Mike, You were right on about it being a SAFEARRAY OF BYTE (00002011)
How do you look at the value of 00002011; safearray and byte are a combined type? In addition, I haven't been able to change the type to integer for some reason (it throws an afxOle exception) and doesn't get to the next instruction in the program.
oneChar.ChangeType(VT_UINT)
Instead, I've set the input mode to text and dereferenced the variant to get an integer... somehow this seems to work... but I'm uncomfortable with it because I don't really understand why. oneChar.vt,x shows 0008, so I understand that the variant contains a BSTR value.
oneChar= m_comm.GetInput();
int b1 = *oneChar.bstrVal;
|
|
|
|
|
Hi All,
I have an MFC dialog App that has several controls in it, including a bunch of Edit boxes.
What I'd like to do is trap the "Enter" key message from each of these edit boxes in order to do some special processing.
How do I do this in an MFC App? I'd like to get the event from that control instead of just trapping a general keyboard message and then having to determine which key was pressed and which control has the focus.
Any suggestions?
Thanks!
Dan
|
|
|
|
|
Maybe you need to handle PreTranslateMessage.
If you subclass the control, have a look at WM_GETDLGCODE.
|
|
|
|
|
CEdit is a CWnd object maybe you can Overide
afx_msg void OnChar( UINT nChar, UINT nRepCnt, UINT nFlags );
|
|
|
|
|
Hi,
I have two identical computers on the network. The VC++ software I wrote can only be running on one of the machines at a time. Is there a way to enumerate or check the exe's running on the other computer.
Thanks
Tim
|
|
|
|
|
I don't think so. If you had a shared location they could both access you could create a file there though which would indicate the program was running.
|
|
|
|
|
There are several solutions. One solution is COM in a local process would connect to the remote process. The remote process would update its status. A simpler solution is socket.
Kuphryn
|
|
|
|