|
hi,
I have a packet filtering driver. How can i do url level filering?
aks
|
|
|
|
|
Looking for an efficient way to do this with out getting duplicates.
int XLOW = 0;
int XHIGH = 10;
do
{
n = rand()% (XHIGH - XLOW + 1) + XLOW;
XHIGH--;
} while (XHIGH != 0);
|
|
|
|
|
Are you simply wanting 10 unique numbers?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
|
Since you want numbers in a predefined range (0-10), the "secret" is to go ahead and fill an array with those numbers, and then just randomly swap those numbers around.
int array[10] = {0};
int n = 10;
for (int i = 0; i < n; i++)
array[i] = i;
for (i = 0; i < n; i++)
{
int j = rand() % n;
}
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
|
I would do (to mimic the extraction of random number from a bag)
void swap (int & a, int & b)
{
int t=a;
a=b;
b=t;
}
int array[10];
int n = 10;
int i;
for (i = 0; i < n; i++)
array[i] = i;
for (i = n; i > 1; i--)
{
int j = rand() % i;
swap( array[i-1], array[j] );
}
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]
|
|
|
|
|
I'm very new to audio. I stumbled across the following code and I'm using the it to play audio .mp3s in my DX9.0 app. ( Nov 08 SDK )
::CoInitialize(NULL);
CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC, IID_IGraphBuilder, (void **)&g_pGraphBuilder);
g_pGraphBuilder->QueryInterface(IID_IMediaControl, (void **)&g_pMediaControl);
g_pGraphBuilder->AddSourceFilter(L"../Media/Audio/Music/Artifact_CharMain.mp3", L"../Media/Audio/Music/Artifact_CharMain.mp3", &pSource);
pSource->FindPin(L"Output", &pPin);
g_pGraphBuilder->Render(pPin);
pPin->Release();
g_pMediaControl->Run();
How can I make the .mp3 loop?
Thanks!
|
|
|
|
|
Fordfanboi wrote: How can I make the .mp3 loop?
I've never worked with the media control. That said, if the COM interfaces provide a feature that you can use to have the control loop the resource that would be the best approach. If it does not, then you will have to code a loop yourself, I guess.
|
|
|
|
|
Fordfanboi wrote: How can I make the .mp3 loop?
See here, about 3/4 of the way down.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
hello,
i have successfully created a button in a toolbar of Outlook Express.
on the click of this button i should be able to get a email address of
the sender from the selected message.
i am getting the name of the sender but not the "Email-Address".
thanks,
Nikhil
|
|
|
|
|
iam doing my project using vc++ 1.52.the objective this project is providing GUI to one devise called quick panel.in this project when i execute Qmgr.exe it is showing the fallowing error."an error has occurred in your application.if you choose ignore,you should save your work in a new file.if you choose close ,your application will terminate." please provide solution
kir_MFC
|
|
|
|
|
And is this a different issue than the one you posted just 2 minutes earlier?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
I am creating a VC++ like IDE development environment. I am confused if it is a SDI or MDI like application. I have read in 'Jeff Prosis' book that it is a 'Workspace based' model. I searched on the net for this type of model but didn't get much help.
Can you please guide me on this.
Thanks
Sandesh
kingmax_007@yahoo.com
|
|
|
|
|
kingmax_007 wrote: I am creating a VC++ like IDE development environment. I am confused if it is a SDI or MDI like application.
Those two statements would seem to be in conflict. A person that does not understand the difference between SDI and MDI cannot have enough experience to develop the project stated in the first sentence.
|
|
|
|
|
might be he just mere developer
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
I have some knowledge of making SDI and MDI applications using SDK windows API's as well as MFC. The project that I am designing now is a tough job for me. The aim of the program is to debug a programming language. It will be having source code open in various windows. There will also be watch and output window like that of VC++ 6.0. My aim is to have single document and multiple views. I want to check if there is any readymade stuff to make this workspace based architecture.
kingmax_007@yahoo.com
|
|
|
|
|
MDI!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Hi
I am working on a CPP that created services.
It complains about the last value in the SERVICE_FAILURE_ACTIONS struct.
According to the Microsoft it is defined as follows:
lpsaActions
A pointer to an array of SC_ACTION structures.
--------------------
When compiling code that calls the function that sets the failure acitons of a server I get the following output.
---------------------------------------------------------------
SC_ACTION *action_array[1];
SC_ACTION* action_str = new SC_ACTION();
action_str->Type = SC_ACTION_RESTART;
action_str->Delay =6000;
action_array[0] = action_str;
SERVICE_FAILURE_ACTIONS actions_struct;
actions_struct.dwResetPeriod = 86400;
actions_struct.lpRebootMsg = NULL;
actions_struct.lpCommand = NULL;
actions_struct.cActions = 1;
LINE(588)---> actions_struct.lpsaActions = action_array;
int result2 = ChangeServiceConfig2W(
service,
SERVICE_CONFIG_FAILURE_ACTIONS,
&actions_struct);
------------------------
OUTPUT
#
Building post_service.dll ...
#
cl.exe @C:\xxxx\nma05692.
#
WindowsService.cpp
#
c:\xxxxxxx\windowsservice.cpp(588) :
#
error C2440: '=' : cannot convert from 'struct _SC_ACTION *[1]' to 'struct _SC_A
#
TION *'
#
Types pointed to are unrelated; conversion requires reinterpret_cast, C
#
style cast or function-style cast
#
NMAKE : U1077: 'cl.exe' : return code '0x2'
#
Stop.
---------------------------------------------
Is there something obvious that I am doing wrong here? My CPP is a little rusty. Would appreciate any help I can get
|
|
|
|
|
Change the declaration of action_array from
SC_ACTION *action_array[1];
to
SC_ACTION action_array[1];
or
SC_ACTION *action_array = new SC_ACTION[1];
If you were to use the second one, you'd have to deallocate action_array at some point, with
delete [] action_array;
HTH!
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
AlainDev22 wrote: SC_ACTION *action_array[1];
SC_ACTION* action_str = new SC_ACTION();
action_str->Type = SC_ACTION_RESTART;
action_str->Delay =6000;
action_array[0] = action_str;
Change to:
SC_ACTION action_array[1];
action_array[0].Type = SC_ACTION_RESTART;
action_array[0].Delay = 6000;
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
"an error has occurred in your application.if you choose ignore,you should save your work in a new file.if you choose close ,your application will terminate."please provide solution for this error.
kir_MFC
|
|
|
|
|
Please give more information on this? just by giving an error like this we will not be able to help you.
|
|
|
|
|
iam doing my project using vc++ 1.52.the objective this project is providing GUI to one devise called quick panel.in this project when i execute Qmgr.exe it is showing the fallowing error."an error has occurred in your application.if you choose ignore,you should save your work in a new file.if you choose close ,your application will terminate."
kir_MFC
|
|
|
|
|
kir_MFC wrote: ...when i execute Qmgr.exe...
Using what?
kir_MFC wrote: ...it is showing the fallowing error."an error has occurred in your application.if you choose ignore,you should save your work in a new file.if you choose close ,your application will terminate."
Have you searched?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|