WM_KEYDOWN issue
HI All,
Suppose I select a menu item by pressing "Enter" key. The command for the
menu item gets executed. But the WM_KEYUP event generated in this case is
used by one of the functions in my application that I have written for the
WM_KEYUP event. As a result, from that one "Enter" key, two functions are
executed which I dont want. I dont want to write my functions on WM_KEYDOWN
event. So, is there any way out to solve this problem? Can this WM_KEYUP
event generated during a menu item selection be nullififed somehow?
TIA,
Gary Tag: Apply these security pack Tag: 218093
Debug settings
Is there a flag you can set to change automatically when
you set the active configuration to Win32 debug? Or do you
have to manually keep commenting and uncommenting the
#define DEBUG statement? Or have i got it wrong, has it
got some underscores, like #define _DEBUG? Tag: Apply these security pack Tag: 218092
float to double conversion inaccuracy
I'd like to present values stored as floats in the
database as doubles. But, the C++ conversion from float
to double adds garbage digits at the end of floats.
E.g.
float x = 1.2345676F;
double y = fabs(x);
ends up with y = 1.2345676422119141.
Does anybody know a remedy? Tag: Apply these security pack Tag: 218091
About the linker
Could somebody judge my thinkings?
When the source file is compiled, the compiler cannot decide dozens of data
or code items that are relocatable, and that's true for real mode and
protected mode programs. When the linker comes in, the addresses are
substituted but no matter how it is linked, the decision is left for the
loader to decide where the programs are to be located? Is that correct?
And I have a question, when the compiler is working, the relocatable items
are set to ----, or floating.... and Linker comes in, the ----'s would be
replaced by the wildcards (F4), zeroes and offsets in lieu? I am
particularly interested in the wildcards as I read some source programs ( as
I couldn't fully understand them) I assume that the wildcards are 0xF4 as I
have seen in there.... Thanks 0xF4, is that correct? or zeroes or floating?
Thanks
Jack Tag: Apply these security pack Tag: 218088
How to stop instanciating the application 2nd time?
Hello,
How to stop instanciating the application 2nd time? after instanciating
once.
Here i run the application once. then the second time if clck on the exe ,it
should not open the application.
how to do this?
thanks in advance.
Venkat Tag: Apply these security pack Tag: 218087
Storing BMP data into a unsigned short int table
Hi !
I wrote a program code to store the values of the pixels
(0->65535) from a BMP picture into a table of unsigned
short int. I tried it with a sample image which is half
white, half black. To check if the storing has correctly
worked, I compare the values of a table of unsigned short
int which I filled with half 0 (black) and half 65535
(white). But I don't get the same result for the table
built from the picture.
Here is what I do :
1. Opening the BMP in binary mode
2. Storing the BMP in a <Size of file> buffer
3. Retrieving only picture data in a 1024*1024 buffer
4. Comparing the filled tables in a loop : printing the
elements of the table that are different
By execution, I get this :
** Filling artificially table
** Filling table from real pictureFilling real table
** n_frame : 524288 # table_to_fill[] : 65535 frame[] = 0
** n_frame : 524289 # table_to_fill[] : 65535 frame[] = 0
** n_frame : 524290 # table_to_fill[] : 65535 frame[] = 0
** (...)
So it means, that from the index 524288, the elements are
not equal anymore. Can anybody understand ?
Thanks for your helps, hints and suggestions.
Please find below the whole code.
void main()
{
FILE *pFile; // Pointer to the
image file to process (to extract the drop profile from)
unsigned short int* table_to_fill; // half black
half white
unsigned short int* frame; // The frame is
supposed to store only image data (and not header
information)
unsigned short int* frame_total; // The frame is
supposed to store the whole image file
int n_frame;
long lSize; // Size of the file to
analyse (including both image and header data)
// Notice !
// lSize : length of the file in bytes (8bits)
// buffer defined as (unsigned) short int (16bits or 2
bytes)
//************OPENING AND SETTING UP FILE
POINTER************//
if((pFile=fopen(PHOTOBW,"rb"))==0) printf("Open file
failed\n"); // Read only Opening BMP file
fseek (pFile , 0 , SEEK_END); // obtain file
size
lSize = ftell (pFile);
rewind (pFile); // Replace the
pointer to the beginning of the file
frame_total = (unsigned short int*) malloc (lSize * sizeof
(unsigned short int)); // allocates memory
frame = (unsigned short int*) malloc ((1048576) * sizeof
(unsigned short int));
table_to_fill = (unsigned short int*) malloc ((1048576) *
sizeof(unsigned short int));
if (frame == NULL || frame_total == NULL ||
table_to_fill==NULL) // Problem by
buffer allocation
{
printf("Error by buffer allocation \n");
exit (2);
}
fread (frame_total,1,lSize,pFile); // copy the
file into the buffer. The whole file is loaded in the
buffer.
printf("Filling artificially table \n");
for(n_frame=0;n_frame<(1024*1024);n_frame++)
{
if(n_frame<(1024*1024*0.5)) table_to_fill[n_frame]
=0;
else table_to_fill[n_frame]=65535;
}
printf("\n");
printf("Filling table from real picture");
for(n_frame=0;n_frame<(1024*1024);n_frame++)
{
frame[n_frame] = frame_total[n_frame+28]; // Copy
the BMP data
}
// Compares the 2 tables
for(n_frame=0;n_frame<(1024*1024);n_frame++)
{
if((table_to_fill[n_frame]-frame[n_frame])!=0)
{
printf("n_frame : %d # ",n_frame);
printf("table_to_fill[] : %d frame[] = %d
\n",table_to_fill[n_frame],frame[n_frame]);
}
}
printf("\n");
}
Guilhem Martin. Tag: Apply these security pack Tag: 218085
Why the duplicat postings about the Microsoft Security patch
Anyone know why this ng (and other Microsoft ngs) are being inundated by
multiple postings about the Microsoft 'October 2003' Security Patch?
There at least 20 a week on this ng alone. Many from posters with forged
addresses.
Should wish we had a NG Monitor. Tag: Apply these security pack Tag: 218079
Compile error:dependent name is not a type
I'm getting a compile error on VC7.1 that I dont understand. The help
explains that this is a breaking change for VC++.NET 2003 compiler, made in
order to conform to the ISO C++ standard, and I've tried it using VC7.0 and
it compiles ok. The problem is declaring an iterator var for a vector
containing a nested structure, the vector instatiates ok using the nested
structure so I dont understand why the vector::iterator var does not also
instatiate, it does instatiate in main().
Any insight would be appreciated.
--- Compile error (its only a warning but leads to other errors)
c:\Developer\Projects\Test Old Compiler\TestOld1\class.h(18) : warning
C4346: 'std::vector<TestClass<_Ty>::TestStruct>::iterator' : dependent name
is not a type
prefix with 'typename' to indicate a type
c:\Developer\Projects\Test Old Compiler\TestOld1\class.h(19) : see
reference to class template instantiation 'TestClass<T>' being compiled
--- class.h
#pragma once
#if !defined(class_h)
#define class_h
#include <vector>
#include <iterator>
template<class T> class TestClass
{
public:
struct TestStruct
{
int i;
};
std::vector<TestStruct> con1; // compile-link-run ok without next line
std::vector<TestStruct>::iterator it1; // ERROR ON THIS LINE
};
#endif
--- main.cpp
#include "class.h"
int main ()
{
TestClass<int> oTestClass;
TestClass<int>::TestStruct oTestStruct;
std::vector<TestClass<int>::TestStruct>::iterator it1;
oTestStruct.i = 5;
oTestClass.con1.push_back(oTestStruct);
it1 = oTestClass.con1.begin();
return 1;
} Tag: Apply these security pack Tag: 218075
Cannot Delete DFS
I am creating a DFS link using NetDfsAdd() API with
following parameters:
CString str1 = "\\\\mc1\\users\\AAAATest";
CString str2 = "mc2";
CString str3 = "users\\AAAATest";
res = NetDfsAdd(str1.AllocSysString(), str2.AllocSysString
(), str3.AllocSysString(), (unsigned short *)"",
DFS_ADD_VOLUME);
This creates the DFS link fine. The when I try to delete
this link my call to NetDfsRemove() fails giving "The
indicated server share does not support the indicated DFS
namespace" error. I am using NetDfsRemove as follows:
CString str1 = "\\\\mc1\\users\\AAAATest";
CString str2 = "mc2";
CString str3 = "users\\AAAATest";
res = NetDfsRemove(str1.AllocSysString(),
str3.AllocSysString(), str3.AllocSysString());
Can someone please tell me what can be wrong?
Thanks,
Vikram Tag: Apply these security pack Tag: 218073
Current Issues Article Archive
A growing archive of fascinating media articles on current issues & affairs.
Available at Arcis Foundation Website:
www.arcis.co.uk/php/
--
Posted by News Bulk Poster
Unregistered version Tag: Apply these security pack Tag: 218050
Socket questions
Hello !
Some questions about sockets....
I'm trying to do a program that uses sockets, and I have (as usual) some
problems ...
1. When I'm trying out my program I'm getting errors, I think this is
because I'm using the local host as the target adress for the client, and on
the local host the server program is already running, this makes it so that
the client can't bind to the socket, because the server is already bound to
it. How do I fix this ? Any way to set so a socket can be shared, or have I
totally misunderstood the whole socketsthing, don't I need to bind both of
them ?
2. My program is an console application, is there anyway that I can make it
event-driven ? Like for example when a client is trying to connect, pause
what the server is doing, handle the connect request, and then continue with
what it was doing. How could this otherwise be done ? I don't want to use a
while loop that loops infinitely...
TIA Tag: Apply these security pack Tag: 218049
Visual Studio Resource Editor Bugs
Help! I'm an undergraduate doing an MFC assignment using Visual
Studio 7 and the resource editor has suddenly starting doing strange
stuff. I created a number of new menu items, and the Resource.h file
now contains #define statements for them that just don't work, for
instance:
#define ID_EDIT_INCR 0
#define ID_EDIT_ADD 0
All new Menu IDs are given the value of 0 instead of 130 or whatever
they should be. Does some intelligent person out there know why this
is happening, how I can stop it from continuing, or how I can find out
what values they SHOULD be so I can manually change the values in the
Resource.h file? I can't ask my tutor because it's the weekend and I
can't continue work on my assignment until I get this fixed. I've
searched Google archives for hours and can't find anything of use.
Thanks in advance for any help that is offered.
Rowena. Tag: Apply these security pack Tag: 218048
Show own controls in third-party app
Hi,
in my application I start a third-party application from my program.
I want to display some controls (at least a bitmap, which is changed
to display status info, if possible a button as well).
The input focus should remain by the third-party app. My static control
should always be displayed on top.
Any idea? If there is a solution would it be possible to display a button
on top as well where both the button in his region and the third-party
app in the remaining area have input focus.
Thanks in advance,
Thomas Tag: Apply these security pack Tag: 218044
DLL function declaration problem
Hi There,
I have created a DLL in C++. A particular DLL function works fine when
called from a C++ program, however when trying to call the same DLL function
in VB an error is recieved 'Bad DLL Calling Convention'
The function is exported in the DLL as follows:
EXPORT void StartKeyboardHook(LRESULT (*)());
and imported in the VB application as follows:
Public Declare Sub StartKeyboardHook Lib "HooksLIB.dll" (ByVal CallBackFunc
As Long)
The function is then called in vb as follows:
Call StartKeyboardHook(AddressOf KeyPressed)
Any ideas?
Josh Tag: Apply these security pack Tag: 218024
Console Application
Hopefully this is the correct newsgroup.
Learning Visual C++ .Net, I wrote a simple console application in C (using
Win32 Console Application option and Empty project).
Unfortunately, I can only execute it from the IDE using Execute non-debug
(CTRl+F5) option.
If I simply choose run (F5 option), the console window just flashes by and
never remains displayed. Running the .exe file from command line yields the
same result as running it from the IDE with the F5 option namely, the
console window flashes as program is run. Anyhow, how can I create a .exe
file that can be run from a command prompt and yield the same result as
CTRL+F5 option ?
thanks;
-------------------------------------------------------------
Andrew Tag: Apply these security pack Tag: 218009
What does the -MT option really do?
Hi,
Is there a difference in code generation when you have -MT enabled?
If I have some libraries compiled with no -MT, and some with, what are the
possible problems I might have? If I have compiled everything with -MT, but at
the end I force to link with `libc' is this going to work?
Thanks,
Manu Tag: Apply these security pack Tag: 218004
Help needed on how to use CString ....
I'm starting some c++ programming again after being away from it for awhile,
and now I can't get anything to work. I'm working in Visual C++, and I want
to use CString in a simple console application. When I'm trying to do that,
I get this error : LINK : fatal error LNK1104: cannot open file
"nafxcwd.lib"
What is this file ? I don't have one on my computer, and the msdn help for
CString doesn't say anything about it, so where does the error come from ?
Something to do with the compiling ?
TIA Tag: Apply these security pack Tag: 218002
Join the VC++ Team at the PDC!
Hello, and greetings from the Visual C++ team at Microsoft! We would like
to invite you to join us at the Microsoft Professional Developers Conference
2003, in Los Angeles October 26th through 30th! We'll be talking about our
plans for the future of Visual C++ and about Microsoft's ongoing commitment
to C++.
The conference is nearly sold out, so don't wait to register. You can find
information about the conference at http://msdn.microsoft.com/events/pdc/.
It is another opportunity to voice your opinions directly to the people who
create the product! If you plan to attend PDC and would meet with the
Visual C++ team privately, please let me know!
April Reagan
Release Manager
Visual C++ .NET
Voice: 425-706-9811
http://msdn.microsoft.com/visualc Tag: Apply these security pack Tag: 217993
How to discover if an input string is unicode or ansi???
Hello,
having an application that receives input from users I'd need to be able to
discover if an input string is unicode or ansi and this since on w9x and wME
unicode is not supported (unless the Microsoft Layer for Unicode is
available on the client). Is there a way to discover if a provided input
string is unicode or ansi?
Regards,
Bob Rock Tag: Apply these security pack Tag: 217990
Where to put an object, Imported files
I am putting together a library of usefull functions that
I'd like to include in other projects. I have the
following "set" object that I wan't do define in this
library.
set<char> set_numeric; // declared in a .h file
set_numeric.insert('0');
set_numeric.insert('1');
...
set_numeric.insert('9');
What I've been trying to figure out is where to put the
initialization for the object. I tried putting it in
a .cpp file but there isn't an entry point to the file to
cause the object to initialize with the values.
Any pointers.
Craig Tag: Apply these security pack Tag: 217984
What is the counter part of CreateControl?
If an ActiveX control is created/linked dynamically via
CreateControl, what should I do to release it?
If I don't do anything, the app will exit without calling
the destructor of the control. Tag: Apply these security pack Tag: 217979