|
Function SetWindowText does not show '&' in following example:
pInfo->SetWindowText ("Father & son");
Even if I try it with \x26 instead of '&' it diaplays a blank instead of the '&'.
|
|
|
|
|
|
did u try pInfo->SetWindowText ("Father && son");
|
|
|
|
|
Hi,
thanks a lot. The "&&" works!
|
|
|
|
|
Hi,
using Vista with a standard user (no admin), I cannot start a service using Win32 with OpenSCManager, OpenService etc.
How can I modify the user rights temporary to admin rights, so the functions work properly?
Regards,
Stefan
|
|
|
|
|
You can use the CreateProcessAsUser API to run a process admin and use OpenSCManager from within that process.
«_Superman_»
|
|
|
|
|
Could you provide me with a quick example? Sorry I'm not that into services and user access rights
|
|
|
|
|
|
Hello clever programmers,
I am very new to C++, i shall say a begineer. I am trying to do a project on designing an interactive application for skills training.
My idea is as follows:
I would/have developed an interface (HCI) screen using Visual Studio C++ 2008.
I have created a relational database in Microsoft Access 2007.
1) What I'd like to do is to display the HCI to the user then ask him to enter her name,
2) Then I'de like to get scenarios from my access table to display via a drop down menu. Once, this is done, the user selects the scenario and submits send button for processing.
3) Then I'd like the computer to process the answer and reply back, the reply will come from the access database and shown on the HCI.
4) The process continues until 10 interactions have taken place then a decision for the winner is made by the computer.
What I need is some guidelines on what features of Visual studio I can use to develop this. Keep in mind, I only want to retrieve a record on request. Should I use any wizards to get started....
Pleeease helppp....
Many Thanks for your help,
HK
|
|
|
|
|
Check this.[^] It might be helpful
-Sarath.
"Great hopes make everything great possible" - Benjamin Franklin
|
|
|
|
|
Hi all,
I am using SetLayeredWindowAttributes in order to create an outlook like message.
I have a special show function which moves (with SetwindowPos) the dialog and changes its opcaity while moving.
The dialog fades in (both by movement and opacity change) around the system tray area, and after 3 seconds fades out.
When i call the show function for the first time, all controls on the dialog (bitmap, static text etc.) appear as black boxes, until the fade in effect is done, then he controls appear properly.
Consequent calls to the show function works properly - it shows the controls through all the fade in and fade out procedure.
If i create a thread and call the show function from it then it works fine for the first call also.
I would appriciate it if someone can explain the differnece between calling the function from another thread or form the window thread, the drawing procedure of a dialog and may be offer a way to solve this problem without creating a new thread.
Thanks
Shimon
|
|
|
|
|
One thing that can be tried first is calling UpdateWindow after the first show function call.
- ns -
|
|
|
|
|
Indeed, calling UpdateWindow after the 1st call fixed the problem
Thanks!
|
|
|
|
|
After setting the layered window style, you should call the SetLayeredWindowAttributes() funcion Immediately. Are you doing so?
<blockquote class="FQ"><div class="FQA">dj4400 wrote:</div>I am using SetLayeredWindowAttributes in order to create an outlook like message.</blockquote>
Also take a look at the AnimateWindow() function. I think you can achive the above effect with a single call to AnimateWindow() function.
|
|
|
|
|
how to duplicate a .mak file with same content but diffrent name
kir_MFC
|
|
|
|
|
can't you just copy the file and rename it ?
This signature was proudly tested on animals.
|
|
|
|
|
Hi everyone,
Here is a problem of mine....
I have a function (threadfunction). And i am creating a thread using Createthread() Function from a buttonClick....I have a local integer value in the threadFunction
Each time I click the button,new thread should create,...Its creting new threads , but its overwriting the local integer value ie it is shared by all the created threads....
Please help me out...
Within the threadfunction, I am decrementing the value after each 200 ms,
DWORD WINAPI personal_recv_fnc_thread( LPVOID lpParam)
{
int i=10;
do
{
Sleep(200);
--i;
}while(i>=0);
return 0;
}
I want to run each thread and decrement the value in all thread separately.....ie each thread should decrement its own local value
modified on Thursday, January 22, 2009 6:05 AM
|
|
|
|
|
Member 4250705 wrote: Its creting new threads , but its overwriting the parameter value ie it is shared by all the created threads....
Well, yes, that's the standard behavior. When you start a new thread, you only create the thread, not duplicate any global value. You will need to make the variable local to your thread function in order to have multiple different variables.
Wait, I misunderstood your question. What are you passing to your thread function ? Could you post the code where you call CreateThread ?
modified on Thursday, January 22, 2009 6:08 AM
|
|
|
|
|
but that will again overwrite by all thread...
|
|
|
|
|
Shouldn't you be casting lpParam to an int pointer rather than an int?
|
|
|
|
|
Indeed it should. Are you sure you are not mistaking? Try the following: use TRACE to display your i variable once before the do and every loop inside the do, then run 3 threads, each with let's say- a 300 ms delay and then check out your output window. You should see that when a new thread is started your already running ones are not affected.
So something like this:
DWORD WINAPI personal_recv_fnc_thread( LPVOID lpParam)
{
int i=10;
TRACE("%X: RUNNING THREAD, starting from %d =====================\n", GetCurrewntThreadId(), i);
do
{
Sleep(200);
--i;
TRACE("%X: %d\n", GetCurrewntThreadId(), i);
}while(i>=0);
return 0;
}
...
CreateThread(...personal_recv_fnc_thread...);
Sleep(300);
CreateThread(...personal_recv_fnc_thread...);
Sleep(300);
CreateThread(...personal_recv_fnc_thread...);
...
To be absolutely sure, i tried this. It works as it should.
p.s: next time you post code, use <pre> and </pre> tags please, makes things easier to read.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Member 4250705 wrote: Its creting new threads , but its overwriting the local integer value ie it is shared by all the created threads....
That's not true, according to documentation [^]:
All threads of a process share its virtual address space. The local variables of a function are unique to each thread that runs the function.
You may verify with the following simple test program
Please note: fixed to avoid *disaster* [^]
DWORD WINAPI ThreadProc(
LPVOID lpParameter
)
{
int i=10;
const int BUFSIZE = 0x100;
TCHAR szBuf[BUFSIZE];
HRESULT hr;
do
{
Sleep(200);
--i;
printf("%x %d\n", (INT_PTR)lpParameter, i);
hr = StringCchPrintf(szBuf, BUFSIZE, _T("%x %d\n"), (INT_PTR)lpParameter, i);
if ( SUCCEEDED(hr)) OutputDebugString(szBuf);
} while (i>=0) ;
return 0;
}
bool main()
{
for (int i=0; i<10; i++)
{
DWORD dwId;
CreateThread(NULL, 0, ThreadProc, (LPVOID)i, 0, &dwId);
}
Sleep (4000);
return true;
}
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
modified on Thursday, January 22, 2009 8:07 AM
|
|
|
|
|
Using C-runtime functions in a thread created by a method other than calling _beginthread, _beginthreadex[^] is bad form and a recipe for disaster. The reason the CRT has these functions is that some features of the CRT require thread specific initialisation, which your code is bypassing. The following is quoted from the documentation on CreateThread[^]:
A thread in an executable that calls the C run-time library (CRT) should use the _beginthreadex and _endthreadex functions for thread management rather than CreateThread and ExitThread; this requires the use of the multi-threaded version of the CRT. If a thread created using CreateThread calls the CRT, the CRT may terminate the process in low-memory conditions.
Steve
|
|
|
|
|
You're right, thanks for pointing out.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi,
I want to call a templated function with template parameters chosen at runtime.
for example something like this
func(int x)
{
if( x == 0)
templatedFunction <<int>> y = new templatedFunc<<int>>();
else
templatedFunction <<double>> y = new templatedFunc<<double>>();
}
is this possible in C++?
thx in advance
|
|
|
|