|
Dears
There are two audio output devices :
1. Bluetooth SCO Audio
2. Realtek HD Audio output
And if bluetooth headset connects to PC, the default output device is item 1.
I want to change to item 2. I have tried some methods, but it still unsuccess
I know MCI functions should done it, but I am not sure which functions should use..
Attachment is test code below:
#include <windows.h>
#pragma comment (lib, "winmm.lib")
#include <mmsystem.h>
#include <iostream>
#include <stdio.h>
int main()
{
int AIDChoise;
UINT nDevices = waveInGetNumDevs();
MCI_WAVE_SET_PARMS parms;
DWORD rc;
TCHAR ErrMsg[256];
WAVEINCAPS inwcps;
WAVEOUTCAPS outwcps;
for (int k=0; k < nDevices; k++)
{
waveInGetDevCaps(k,&inwcps,sizeof(inwcps));
printf(" In devname %d : %s \n",k,inwcps.szPname);
}
for (k=0; k < nDevices; k++)
{
waveOutGetDevCaps(k,&outwcps,sizeof(outwcps));
printf(" Out devname %d : %s \n\n",k,outwcps.szPname);
}
printf("Please select output device :");
scanf(" %d",&AIDChoise);
switch(AIDChoise)
{
case 0:
printf("0 ~~~~~~~~~");
parms.wOutput = 0;
rc = mciSendCommand(0, MCI_SET, MCI_WAVE_OUTPUT, (DWORD)&parms);
if ( rc != 0 )
printf("Error Msg : %s \n",mciGetErrorString(rc,ErrMsg,256));
break;
case 1:
printf("1 ~~~~~~~~~");
parms.wOutput = 1;
rc = mciSendCommand(1, MCI_SET, MCI_WAVE_OUTPUT, (DWORD)&parms);
if ( rc != 0 )
printf("Error Msg : %s \n",mciGetErrorString(rc,ErrMsg,256));
break;
default:
printf("2~~~~~~~~~");
printf("Invalid command.. \n");
break;
}
return 0;
}
|
|
|
|
|
yes, I found out...
use "waveOutMessage" function can change audio device..
|
|
|
|
|
Hi,
I would like to use MSAA to access some user interface elements belonging to other applications.
According to tools like AccExplorer or Inspect Objects, the elements I'm interested in are reachable and listed in the tree hierarchy they display.
However, when I use a custom function like WalkTreeWithAccessibleChildren from MSDN (<a href="http://msdn.microsoft.com/en-us/library/dd317975(v=VS.85).aspx">http://msdn.microsoft.com/en-us/library/dd317975(v=VS.85).aspx</a>[<a href="http://msdn.microsoft.com/en-us/library/dd317975(v=VS.85).aspx" target="_blank" title="New Window">^</a>]) I get a different tree, some elements are identical but other have a complete different set of children. The elements I want to access are not available in this tree (I've also tried with methods like get_accChild and accNavigate but it did not work).
Do you know how I can build a tree similar to the one in AccExplorer?
Thank you for your help!
|
|
|
|
|
Hi,
is there any difference between Windows Job and Scheduled Tasks?
I have used the win32_ScheduledJob class for monitoring the scheduled tasks.
But it doesn't return anything even that task in running state.
Please let me know how to create a windows job manually for testing and which win32 class to be used for monitoring?
Thanks
|
|
|
|
|
|
If possible what is the easiest way to reduce the connect inital timeout value from 3 seconds to 1 second or less? The excerpt below reduced the retries which is not good enough for my purposes.
Any suggestions would be appreciated.
Thanks
"Now, the initial timeout value - before the first connection attempt - is 3 seconds. After each retry, the amount of time to wait is doubled (3 seconds, 6 seconds etc.). The number of retries can be configured via the 'TcpMaxConnectRetransmissions' parameter in the registry - the default is set to 3 for Windows NT and 2 for Windows 2000. Thus, the first solution to the connection timeout problem is, to adjust this parameter via the Registry. However, changing the registry is a global change, affecting all applications that use Winsock and/or TCP/IP. The following Knowledge Base article (http://support.microsoft.com/default.aspx?scid=kb;en-us;120642) provides detailed information. Nevertheless, one should be careful while playing with these parameters."
|
|
|
|
|
Alan Kurlansky wrote: what is the easiest way to reduce the connect inital timeout value from 3 seconds to 1 second or less
There is no 3 second timeout for connect() function. You need to implement your own timeout mechanism or use a socket library that does. It's a short answer, hope it helps.
/M
|
|
|
|
|
On a windows(XP) machine i'm trying to inject mouse/keyboard messages (for some remote control; kind of soft-KVM-switch), which works fine as long as a user is logged in. Once the workstation is locked or no user is logged in, the injected messages seem to be ignored. I have tried both mouse_event and SendInput (unsuccessful) as well as to connect the app (runs as nt-service, userinteraction allowed) with the logon-desktop, which (regarding to api-returns) should work, but still no success. Can anyone give me an advice?
|
|
|
|
|
There is [input data] <---- object ----> [output data] program structure.
Input data is processed in a for loop with specific object (class or struct) which takes chunk of input data performs computation and saves results to output data array.
To convert it to OpenMP should I have as many object references allocated as presumed number of threads will be running to avoid its simultaneous access from multiple threads?
It will not be possible to lock the object for a single thread as the multithreading nature dissapears since only one thread at a time will be allowed to perform computation with that object.
Чесноков
|
|
|
|
|
It depends on what your object is. If the object doing the processing is a stateless functor (ideally) then just make one per thread and don't worry about locking it. However if it's got state that's relevant across the whole operation of your program you're going to have to share the object and lock it.
Cheers,
Ash
|
|
|
|
|
I'm running that code on i7 computer with 4 cores and 8 threads
N = 10000;
...
#pragma omp parallel for
for (i = 0; i < N * N; i++)
vec3[i] = vec1[i] * vec2[i];
...
Setting number of threads with omp_set_num_threads to 2, 4 and 8 the performance increase compared to omp_set_num_threads(1) is not consistent: x1.4, x1.55, x1.58
Should be we expect the rates to be: x2, x4, x8 instead?
Чесноков
|
|
|
|
|
If you have 4 cores, the highest ratio that you can theoretically expect is 4; using a number of threads higher thatn the number of cores don't produce significant advantages and can reduce the performances because to execute all of them the system has to switch the thread context a lot of times and this will waste time.
The real speed improvement could be less than expected due to the times required to create the threads at the beginning of the parallel construct and destroy them when the parallel construct terminates; if this is the case, by increasing N the rates should became better (e.g. try N = 1000000 )
|
|
|
|
|
Hi Sauro,
the i7 the original poster is using can run 8 threads simultaneously. There are 4 cores and each core is hyperthreaded.
Cheers,
Ash
|
|
|
|
|
Ops...
|
|
|
|
|
The HyperThreading performance is not actually double the normal performance though, many parts of the CPU are shared competitively between the two threads running on a single core.
|
|
|
|
|
Yep, and that's why I said that each extra core for hyperthreading is worth somewhere between 0.2 and 0.5 a processor for the style of coding he's doing.
Cheers,
Ash
|
|
|
|
|
Yep, and that's why I said that each extra core for hyperthreading is worth somewhere between 0.2 and 0.5 a processor for the style of coding he's doing.
Cheers,
Ash
PS: No I didn't, should have done! Thanks for pointing that out.
|
|
|
|
|
I wouldn't expect a linear scaling of performance with number of threads but I'd expect a bit better performance than that. When manually scheduling my own threads I can get about 4 times the performance on an i7 with 8 hardware execution units for the same sort of problem.
How does OpenMP interleave the memory accesses? There might be a lot of cache contention going on that's causing the slowdown. With my manually scheduled version it's running out of cache that slows mine down.
Looking at it N is fairly small. What happens when you use 10,000,000?
Cheers,
Ash
PS: Another reason you might not be getting as much speed up when you're running more cores is that the i5 and i7 throttle down when running more threads to keep the thing cool. Or as the advertising goes it overclocks up when running fewer threads and is able to keep its' temperature down. My results were with turbo boost (as the marketroids call it) disabled so that might be why my processor's response was a bit more linear.
|
|
|
|
|
It is N*N loop aready with N=10000 it is 10,000*10,000 = 100,000,000 operations.
That already takes 170 ms to process.
I need to optimize code that performs even less operations.
Чесноков
|
|
|
|
|
Missed that. I need glasses
Ash
|
|
|
|
|
I used RegisterHotKey API to provide hot keys for certain events.
If i dont close my application and if i run another then CTRL + C is not working cause i am using it in my application. What shall i do?
Today's Beautiful Moments are
Tomorrow's Beautiful Memories
|
|
|
|
|
I think you are confusing between hotkeys and accelerators: the first one are system-wide key escapes, the second one are limited to the application.
|
|
|
|
|
Oh, so what do we do if we want the key using registerhotkey to be local to the application and not all other applications... or how do we use accelerators like hotkeys... i have not yet experimented accelerators. can you give me an online reference so that i can go through that and use it. thank you.
Today's Beautiful Moments are
Tomorrow's Beautiful Memories
|
|
|
|
|
Accelerators are quite easy to use; the steps required are the following:
- create a new resource of type accelerator table inside your .rc file, then add the entries that you want to that table using the resource editor
- load the accelerator table using the
LoadAccelerators function - inside the message loop of the window that you want to process the accelerators, use the
TranslateAccelerator function to dispatch them
You can read the documentation about accelerator here[^] on the MSDN.
Note: if you are using MFC and your application is based on the document/view architecture, then the project wizard alerady creates an accelerator table for you, and that table is already loaded and used by your frame window (see Managing Menus, Control Bars, and Accelerators (MFC)[^] on the MSDN). If your application is an MFC dialog based one, you should manually add the code to load the accelerator table (you can call LoadAccelerators in the constructor of your CDialog derived class) and to dispatch the accelerators, by overriding the PreTranslateMessage virtual method and calling TranslateAccelerator .
|
|
|
|
|
Wow, thats a nice explanation.
Thank you.
Let me play with those functions and let me try to accomplish my task.
http://vikku.info/
Today's Beautiful Moments are
Tomorrow's Beautiful Memories
|
|
|
|