|
|
Hi,
I wrote a program using VC++ that should scan for available wireless networks in the area.
In my SW I use the commands OID_802_11_BSSID_LIST_SCAN and OID_802_11_BSSID_LIST.
My questions are:
1. How can I Force the Wireless NIC to do ACTIVE SCAN ?
2. According to tests that I did, the card does not flush the list between scans, i.e. I get for several scan a results of an AP that was on air during an old scan, but is no longer there and new scans return's it's data as if it is still there.
I am using Intel PRO 2200BG Wireless NIC, with driver version 8.1.0.28 (dated 24/8/2004).
Relevant information That I used is here:
Some relevant info from the above link:
---------------------------------------
"
The device must do the following when performing an explicit scan in response to a setting of OID_802_11_BSSID_LIST_SCAN:
* The device must flush the current contents of its cached BSSID scan list before initiating the explicit scan request.
* The device must scan both infrastructure and ad hoc networks, regardless of the current setting of its network mode.
* The device can use either the active or passive scanning methods, or a combination of both scanning methods.
Note Active scanning is preferred whenever appropriate.
* When performing an active scan, the device sets the BSSID to the broadcast MAC address in the 802.11 probe request that it sends. The device also sets the SSID to the zero-length broadcast SSID in the probe request.
* The device must perform the scan across all the frequency channels and bands that it supports.
* The miniport driver must minimize its response time for this OID. It is recommended that the driver just initiate the scan and return NDIS_STATUS_SUCCESS in response to the setting of OID_802_11_BSSID_LIST_SCAN. The driver must not return NDIS_STATUS_PENDING or wait for the scan to complete before returning NDIS_STATUS_SUCCESS.
"
-------
Any help will be appreciated.
-- Amit.
|
|
|
|
|
|
NDIS_802_11_BSSID_LIST* m_pBSSIDList;
m_pBSSIDList = (NDIS_802_11_BSSID_LIST *) VirtualAlloc (NULL,
sizeof (NDIS_802_11_BSSID_LIST) * NUMBEROF_BSSIDS,
MEM_RESERVE | MEM_COMMIT,
PAGE_READWRITE) ;
memset (m_pBSSIDList, 0, sizeof (NDIS_802_11_BSSID_LIST) * NUMBEROF_BSSIDS);
oidcode = OID_802_11_BSSID_LIST_SCAN;
DeviceIoControl (m_handle,
IOCTL_NDIS_QUERY_GLOBAL_STATS,
&oidcode,
sizeof(oidcode),
(ULONG *) NULL,
0,
&bytesreturned,
NULL);
Sleep (6100);
memset (m_pBSSIDList, 0, sizeof (NDIS_802_11_BSSID_LIST) * NUMBEROF_BSSIDS);
oidcode = OID_802_11_BSSID_LIST;
if (DeviceIoControl( m_handle,
IOCTL_NDIS_QUERY_GLOBAL_STATS,
&oidcode,
sizeof( oidcode),
( ULONG *) m_pBSSIDList,
sizeof( NDIS_802_11_BSSID_LIST) * NUMBEROF_BSSIDS,
&bytesreturned,
NULL) == 0)
{
return NULL;
}
else
{
return m_pBSSIDList;
}
|
|
|
|
|
i have a CString :"121 232 3232"
i want to cut it into 3 pieces : "121" ; "232"; "3232"
and convert them to "int". can you help me? Thanks!
|
|
|
|
|
CStringT::Tokenize is the method for you, have a look at the nice example in the documentation [^].
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]
|
|
|
|
|
You could use sscanf , or strtok or std::istringstream (or somthing like that, I always forget which one it is).
Me think the easier, but less safe and probably not well accepted today is sscanf :
int iRet = sscanf(input, "%i %i %i", &val1, &val2, &val3);
or maybe
std::istringstream buffer(input);
int val1, val2, val3;
buffer >> val1 >> val2 >> val3;
and in general, to convert a string to a int, we can use atoi ( or atol )
This signature was proudly tested on animals.
|
|
|
|
|
tucn87 wrote: i want to cut it into 3 pieces : "121" ; "232"; "3232"
Carlo has answered this part...
tucn87 wrote: and convert them to "int". can you help me? Thanks!
Take a look at _ttoi[^]
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
There's also AfxExtractSubString() .
"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
|
|
|
|
|
Base 10 conversion is so simple, just write your own quick parser to walk the string and convert each chunk at the same time.
|
|
|
|
|
hi vc++ programmers,,
i am getting the following errors in migrating my code from vs-2--3 to vs-2008...
FeeEnterView.obj : error LNK2019: unresolved external symbol "public: __thiscall ATL::CTime::CTime(void)"
and
fwstissr.obj : error LNK2001: unresolved external symbol ___security_cookie
can enbody show a remedy for this....thanks in advance
modified on Wednesday, September 9, 2009 11:04 AM
|
|
|
|
|
Hi,
I have couple of text files in JAR. I want to access them in my C++ application. Basically I want to get the FILE pointer to those file. Please let me know how would we do it.
thanks in advance
Umrahi...
If you have faith in the cause and
the means and in God, the hot
Sun will be cool for you.
|
|
|
|
|
See here for ideas.
"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
|
|
|
|
|
Why don't you use the jar tool to decompress the files?
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]
|
|
|
|
|
Judging from the header, they are simple ZIP files. Try one of the ZIP/UNZIP classes here on CP to access them.
|
|
|
|
|
I am creating a vs2005 vc++ application and trying to get a secondary thread setup and working. I have read through the various postings and tried to put some code together but it won't compile.
I am trying to start the new thread from a menu item via a message handler based in my application's 'CView' based class. I have created a new class of my own (GcWorkerThread) and is derived from CWinThread, and contains a member function 'GcThreadFunction'
calling code:
int x;
CWinThread *pThread = AfxBeginThread (GcThreadFunction, x);
UINT GcWorkerThread::GcThreadFunction (LPVOID pParam)
{
int t;
for (int y=0; y<1000000; y++
{
}
}
When is comes to compiling the code I get an error:
"Error C3867 'GcWorkerThread::GcThreadFunction' function call missing argument list
use &GcWorkerThread::GcThreadFunction to create a pointer to member"
What am I doing wrong?
|
|
|
|
|
You cannot pass a instance method to AfxBeginThread . You've to pass a standard function or a class (i.e. static ) method.
BTW: have a look at this [^].
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]
|
|
|
|
|
try with the following change.
int x;
CWinThread *pThread = AfxBeginThread (GcThreadFunction, &x);
Thanks and Regards,
Selvam,
http://www.wincpp.com
|
|
|
|
|
GC104 wrote: I have read through the various postings and tried to put some code together but it won't compile.
Instead of reading through the various postings I can suggest reading this[^] useful article about worker threads.
[edit] Sorry I didn't see that CPallini have already gave this link [\edit]
Regards
Nuri Ismail
|
|
|
|
|
Info gratefully received, I have gone away and think I now have a better understanding of what a 'static member function' is all about. However I'm struggling with the example given on the link given. see below:
static UINT run(LPVOID p);
void run();
volatile BOOL running;
To start a thread, your handler does
void CMyView::doInvert()
{
running = TRUE;
AfxBeginThread(run, this);
}
UINT CMyView::run(LPVOID p)
{
CMyView * me = (CMyView *)p;
me -> run();
return 0;
}
void CMyView::run()
{
for(int x=y = 0; running && y < image.height; y++)
for(int x = 0; running && x < image.width; x++)
changePixel(x, y);
running = FALSE;
}
|
|
|
|
|
// why is a 'this' pointer passed as the pParam?
Because of what static functions implies: a static function is shared among all instances of a class. This means that within a static function, you cannot access non-static members of the class. In order to be able to do so, you need to identify which instance you want to manipulate. This is the reason why you pass the instance as a parameter to the thread function.In fact, a static function is similar to a global function in this context.
//why is 'p' cast from something that already seems to be
//a CMyView pointer already?
Because it is received as a LPVOID, which doesn't mean anything. So, to be able to call the Run function on the instance, the compiler needs to know that it is a CMyView object (it can't guess it).
|
|
|
|
|
Just adding to the previous reply
GC104 wrote: // why is a 'this' pointer passed as the pParam?
Because inside the worker thread, a CMyView object is being manipulated (in this case). This particular thread function needs a CMyView object be passed to it.
Note: However, it would be a lot better if threads can accept any object (or data type) passed as the parameter in general. Because different threads do different things. Some threads won't require anything at all. Therefore, the best approach would be to pass a pointer to "something". And this something is known to the calling code (it sets up the parameter) and the thread also know what exactly is the pointer pointing to and so you cast it to the appropriate type.
GC104 wrote: //why is 'p' cast from something that already seems to be
p is a pointer to void (remember that LPVOID is nothing but void * ). Therefore, you must cast it to an appropriate type (read my note above?)
Hope that helps.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Many thanks for help given, I now have a basic 'thread' the compiles and does roughly what I expect
|
|
|
|
|
Hi All,
How do I rename a newly created pst folder 'Personal Folders'
in Microsoft Outlook programmatically.
Any script (vb OR VC++ COM, automation, etc.) or a bit of
guidance would be helpful
Thanks in Advance
|
|
|
|
|