|
Anyone have any experience with changing an environment variable via the registry and then updating the system to recognize the change?
I have been able to successfully change the environment variable, but if I then open a command prompt it doesn't see the changes.
However if I then open up the System Properties, goto the environment variable section and open it up, click OK, then the desktop flickers, and the refresh occurs.
According to what I can find you're supposed to call
SendMessageTimeout( HWND_BROADCAST, WM_SETTINGCHANGE, 0, (LPARAM)"Environment", SMTO_NORMAL, 1000 );
However this does not seem to work for me.
Anyone else deal with this, and if so how?
Thanks !
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
|
|
|
|
|
What does SendMessageTimeout() return? Have you tried increasing the uTimeout value?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
I'm such a boner!
It turns out that the string values can't be string values !
They have to be expandign string values, i.e. REG_EXPAND_SZ! Once i changed that in the installer, everything worked fine!
I feel like such a friggin idiot
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
|
|
|
|
|
I'm glad you figured it out, because I would not have guessed that given your original post.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Well it turns out that was only part of problem.
The enrionment vars get expanded but they still don't seem to get refreshed.
I can run the installer, and open the System Properties and see hte new values correctly, but if I start a command prompt, and type the executable (whose path was added to the Users PATH env var) name, it just craps out and says it can't run the program. So apparently I still am doing something wrong
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
|
|
|
|
|
Jim Crafton wrote:
...but if I start a command prompt, and type the executable (whose path was added to the Users PATH env var) name...
So at the command prompt, the PATH environment variable is correct, but the executable cannot be started. Is that right? If so, it appears that deeper issues are at play here.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
I am trying to get some value in a particular cell on CDataGrid specifiying
the field name. When there is nothing in a cell, always return me error saying
type is not much. I am not sure what is wrong with my code. please
help me looking at the following code.
CColumns Cols = m_DataGrid.GetColumns();
VARIANT varCol;
varCol.vt = VT_BSTR;
CString str_MyColumn = "MyColumn";
varCol.bstrVal = str_MyColumn.AllocSysString();
CColumn Col = Cols.GetItem( varCol );
VARIANT varValue = Col.GetValue();
CString str_WhatisValue = varValue.bstrVal;
Thanks
shin
|
|
|
|
|
hello!
I´m working with MFC. I´m making same threads where I execute a Query in a database. It use same CString, int and command variables.
It is an Example:
void STLogLatido::DoWork(void *pThreadContext)
{
_set_se_translator(SeTranslator);
try
{
CString id = GetParamID(2,msg);
//ejecutar comando
_bstr_t sql;
sql = "execute dbo.sp_latido @id_empleado=" + id;
pConn->Execute( sql ,NULL ,0);
}
catch (...)
{
}
delete this;
}
That work greate, but when the thread finish the memory process have been increased 4k.
Does anybody can help me?
|
|
|
|
|
VietDelphi wrote:
...when the thread finish the memory process have been increased 4k.
What did you expect to happen?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Well.... I believed that when the thread was finished, It had to free all the memory which was used by the thread.
Am I wrong??
|
|
|
|
|
VietDelphi wrote:
Am I wrong??
Yes, in a way. See the last section of this article for a better description than I can type.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Thanx!!... I´ll read
|
|
|
|
|
Hi guys,
I'm working on my first MFC app and have hit a small issue with a palette window which needs to sit above the main view but all other dialog's should appear above it in the Z order. Currently the extended style is set to WS_EX_PALETTEWINDOW but this keeps the window on top of everything else. So even my File Open dialog disappears beneath it.
How can I specify this palette should always appear above the main window but below all else?
Thanks for any help,
Simon
|
|
|
|
|
The extended style WM_EX_TOPMOST (Part of WM_EX_PALETTEWINDOW) causes the palette window to be ALWAYS on top Z order, like stated in the Reference.
To overcome this problem, remove the style flag, and always when you create new dialogs or windows, or a window of your choice has focus, use SetWindowPos to place it's Z-order.
For example, when user opens your application, after the window objects are created but before they are shown, you place them with subsequent calls to SetWindowPos member methods to place their Z-orders in the way you please. Or, when your mainframe gets focus, you place the mainframe window under the palette window. Simple.
Again, when user clicks on the button to create the File Open dialog, then first position the windows, then create the dialog and make it modal to the application. This way it will always be on top of your app.
The key is to reposition the windows always when something, which would change the window display order, happens (Like gaining/losing focus, modal messageboxes/dialogs etc)
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Great, thanks for your help Antti.
|
|
|
|
|
Sorry to bother you again but I'm still tearing my hair out with this palette window problem. I've added a handler in the MainFrame class to pick up MoveWindow notifications. This works okay. It gets a pointer to the View class and calls the UpdatePalettePos function.
Inside the UpdatePalettePos function I try to use SetWindowPos to move the palette and bring it back on top of the mainframe. However, the minute I try to access anything within the palette object the application bombs. Even m_dlgPropertySheet->GetWindowRect(rPropsRect); causes a crash. Yet the exact same function is called elsewhere within the View class and works fine.
Ahhhhhhh!
Please help!?
Simon
|
|
|
|
|
Run the debugger, setting a breakpoint before the call to UpdatePalettePos. Enter this call, and see where your application crashes. Now, debug again, this time paying attention to different variables and pointers, if they point to correct locations (For example, the m_ptrPalette in CMainFrame must match with 'this' in CPaletteWnd).
After you have specified the position of the crash, take note of the error it gives you. Is it an assertion error ? An access violation ? What is the error message with the crash ? Note that you won't see these error messages unless you use the debugger.
With this information, post the error code, and a exerpt from the code flow. Post the point where you call UpdatePalettePos and the declaration of this function.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
How can I pass a function that sorts an array of test scores in ascending order?
|
|
|
|
|
std::sort does sorting. The easy version uses your test scores' operator< for determining sort order. It gets a little more complex if you want to sort by other orders.
Or do I misunderstand your question?
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
dynamicall allocate an array large enough to hold any number of test scores to user wishes to enter. the array should then be passed to a function that sort them in ascending order. I can use std:sort under namespace std; to do that. I thought a num++ or num-- or a if statement?
confused on what to do
|
|
|
|
|
iasaber wrote:
I thought a num++ or num-- or a if statement
num++/num-- do increase/decrease num. They do not change their position in the array!
To do that you need to copy one array member to a local variable, copy the one to exchange to its position and copy your local copy to the position where the other one has been.
Dynamical allocation of your array can be done by the STLs std::vector, but I think the point is you learning to handle objects
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
Have you looked at qsort() ?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
I am using common color Dialog box in console Application, but when I move that Dialog the previous image of Dialoge not erased, any suggestion please
|
|
|
|
|
In here, you need to create a Windows (or MFC) program with a view. Then bind console entry to that view. Now you can use dialogs normally.
If you created a console application that supports MFC and then tried to create a dialog inside the program, I believe it might show symptoms like that.
Paste some code on how you do it now.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
I am using OPENGL for creating console base window with in the Console Application, from that window I am opening Color Dialog, may be the window created by OPENGL causing this problem, but I am not sure, any way I am sending the code which Creates the window and does some other tasks,Take a look on it , if u know OPENGL and tell me something please.
int main ( int argc, char** argv )
{
glutInit ( &argc, argv );
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
glutInitWindowSize ( 640, 480);
glutCreateWindow ("Solar System Simulator");
glutKeyboardFunc (keyboard);
glutDisplayFunc (display);
glutMainLoop ( );
return 0;
}
|
|
|
|