Class problem
Hello,
I got a class that i defined
class ProbabilityEngine
{
public:
static int index_x;
static int index_y;
static LaplaceStatistics *Laplace_array;
static GaussStatistics *Gauss_array;
void CreateFeat();
void CreateXis();
};
I then define the functions in the .cpp and initialise the static
menbers variables and functions.
But when I try to do the following :
ProbabilityEngine my_engine;
my_engine.CreateFeat();
I get the error : D:\Bayesian Programming\Form\FormDlg.cpp(50) : error
C2143: syntax error : missing ';' before '.'
D:\Bayesian Programming\Form\FormDlg.cpp(50) : error C2501:
'Prob_engine' : missing storage-class or type specifiers
D:\Bayesian Programming\Form\FormDlg.cpp(50) : error C2371:
'Prob_engine' : redefinition; different basic types
D:\Bayesian Programming\Form\FormDlg.cpp(40) : see declaration
of 'Prob_engine'
and really i'm lost...could there be a problem with static members or
something else? Tag: Change Window Border color Tag: 245785
Mutex and Critical Sections
I've recentley read about mutex objects. For all the multi-threaded apps I've
wrote, I've used Critical Sections. Do mutex objects have an advantage? Or is
it just preference?
Thanks,
Mark. Tag: Change Window Border color Tag: 245781
DDE question 2
I would like to know why if I activate a DDE connection I can't start a new
Iexplore window. This DDE connection is from a software to another that not
use Iexplore in any way. Why DDE stop Iexplore? Tag: Change Window Border color Tag: 245780
shared variable in DLL
hello,
How can I define a shared variable in a DLL that all instance of the DLL
use it ( similar to a static variable in a class).
Best regards Tag: Change Window Border color Tag: 245776
Error C2664: 'CreateProcessA' : cannot convert parameter 2 from 'const char *' to 'char *'
Hi all ..
Can someone enlighten me why on this earth is this code giving out the
error.
const char *Path = "\"C:\\winnt\\system32\\cscript.exe\"";
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
si.dwFlags = STARTF_RUNFULLSCREEN;
ZeroMemory( &pi, sizeof(pi) );
// Start the child process.
if( !CreateProcess(NULL,
TEXT(Path),
NULL,
NULL,
FALSE,
CREATE_NEW_CONSOLE,
NULL,
NULL,
&si,
&pi ))
{
printf( "CreateProcess failed (%d).\n", GetLastError() );
return;
}
But when i pass the same path, hardcoded into the function,
createprocess, it compiles fine. What am i doing wrong ??
Thanks for your time !!
Prakash437 Tag: Change Window Border color Tag: 245772
What is the operation symbol "^" do?
#include "stdafx.h"
int main(int argc, char* argv[])
{
int a=2;
int b=7;
printf("%d",a^b);
return 0;
}
answer is 5, but I don't know what is it doing....
Best regards,
Boki. Tag: Change Window Border color Tag: 245766
Reuse previous compiled precompiled headers
Hi!
Is it possible to prebuild precompiled headers just like we prebuild
libraries? What I want to be able to do is to build precompiled headers for
Ogre3D so that my students can use this precompiled headers without having to
build their own since they have a limited amout of disk space. When I try to
use the precompiled headers for another project Visual Studio .NET reports an
error stating that the .pdb file used by the current project isn't the same
.pdb that was used when the precompiled headers were created.
Is there a simple solution to my problem?
Kind regards
Michael Tag: Change Window Border color Tag: 245763
no default operator ==
Hi,
I'm trying to compare between two objects of a simple class:
class A
{
int num;
}
void foo()
{
A a,b;
if (a == b)
{
... do domething
}
}
from some reason, it doesnt let me compare the objects. Am I wrong or there
should be a default operator == between the objects?
I get the error:
c:\test\t1.cpp(12) : error C2676: binary '==' : 'A' does not define this
operator or a conversion to a type acceptable to the predefined operator
why???
Help will be appreciated.
Ram. Tag: Change Window Border color Tag: 245757
variadic macros in vs8 beta2
Noticed this behavior, which is probably undesirable. Hopefully this gets to
the right people before ship time :)
#define BAR(a,b,c) ((a)+(b)+(c))
#define FOO(x,...) BAR(x,__VA_ARGS__)
FOO(1,2,3)
This should parse, but it doesn't. Preprocessor complains about there not
being enough arguments to BAR. This example works in GCC and other
conformant compilers (which also support named variadics, in the form
#define BLAH(x,name...) printf(x,name)
--chris Tag: Change Window Border color Tag: 245753
HELP on "C" DLL internal code for LAN's and WAN's use
To all wizards:
I have a "C" DLL file already built and running, but I want to have the DLL
accessible(callable) from anyway within a LAN and/or WAN( and even
multi-WAN's), or even on a PC. I built the DLL file, via VC++'s (v6.0) ATL
COM AppWizard area, and it works quite well. But as for using the DLL file
on LAN's and Wan's, do I need to add any more code into the DLL file, so it
will work on/under a network and be callable anywhere on a LAN's or WAN's or
even on standalones by any and all application(s). If I need some
additional code, can you tell me why, and can I get it in simple "C" source
code. Any help would surely be greatly appreciated. Thanks(TIA),
Tom. Tag: Change Window Border color Tag: 245752
128 bit math routines
Does any one know if the New Visual Studio 2005 will support QUAD precision
math routines?
Where sizeof(long double)==16 bytes Tag: Change Window Border color Tag: 245747
Declaration and Definition
I declare a function that is virutal without implementation code in my base
class, the derived class does not implement it so link error occurs. My
question is how do you make the base class code swung into action?
class A
{
virtual int Run(void);
};
class B : public A
{
want to use class A's code, what can be done?
Thanks
Jack Tag: Change Window Border color Tag: 245734
Stealth activation of exe upon right-button -down event?
I appologise for bringing this here, however I don't know of more savvy
group of folks to ask this question to.
I was in the process of deleteing an exe, I decided to not install it. It
took about 3-5 seconds for my right-click menu to activate. I sensed that
there was alot going on behind the scenes on this event. Am I being paranoid
or is it possible that this is by design to secretly get into a computer?
I'm using Win2000 with symantic corprate edition av.
any help appreciated. Tag: Change Window Border color Tag: 245732
Using STL with classes generated dynamically
Hi --
I am currently working on a Forth-inspired virtual machine that I use as a
run-time for executing domain-specific languages that are generated on the
fly from visual models. This machine is created out of thin air at runtime
by writing Intel assembler codes into memory for the 32 primitive
instructions, the execution engine and for a rudimentary parser that can
interpret and compile Forth instruction streams. Once this initialization
is done, then the Forth machine accepts streams of forth words and
bootstraps itself into a more full-fledged execution environment that
includes a type system, classes, an intel code assembler, floating point
math, etc. This is all kicked off from within some host program that must
be written in a language that supports writing bytes to memory and then
jumping to one of these locations to execute the code thus assembled. (I've
tried to keep the host requirements limited to these two so that this scheme
can also eventually work in an embedded environment with only ROM-based byte
sequences to kick it off.)
Please bear with me and I will get to my queson in one second; I just have
to talk about one more thing to frame it correctly. The runtime environment
that emerges from this scheme involves a few different levels: there's the
basic intel assembler level that I have access to through the virtual
machine; there's the virtual machine itself, which executes any named
sequence of the underlying primitives that has been compiled into the
system's code dictionary or that is presented to it for run-time
interpretation (or any sequence of other such named sequences) ; and then
there's the runtime of the host program. While I'm trying to keep the
virtual machine simple and capable of executing in just about any
environment that satisfies the two requirements I mentioned earlier and that
has had an appropriate execution engine generated for it, I also want it to
be able, when it's useful, to interact with both the underlying processor
and with the host executable environment. I accomplish this through two of
the primitives -- one that executes underlying assembly code and the other
that makes far calls to the host environment. This presents a great degree
of choice about which level to program specific functionality at and allows
me to use facilities of a host language to handle stuff that had not yet
made its way into the forth-based portable environment or that can be
handled better by the host in a context where I am willing to sacrifice
portability.
More specifically (and more relevant to this newsgroup) when the host
programming environment is a C++ executable, I would like to enable as much
interaction as possible with the C++ run-time. For example I have a project
coming up for a client for a simulation system for which I would like to be
able to use the STL and the C++/CLI extensions for the .NET framework
library. So here's my question. I want to use the type-generating and
dynamic execution capabilities of my embedded Forth environment to create
execution streams on the fly from visual models that the user creates and
manipulates at run-time. On the other hand, in the course of executing
these I would like to leverage STL containers and algorithms to take
advantage of rich programming facilities like Boost and Loki (in particular
the Boost Graph Library).
Now I realize that by the time my application runs, code templates are gone
and the only thing that remains of them are type-specific classes that have
been expanded at compile time. So my original thought to somehow create new
expansions with my dynamically generated types is impossible, since at that
point there is nothing to expand from. However, I'm envisioning something
like the following, and would just like some basic validation on whether it
seems feasible to minds more experienced and wise than my own: If I gnerate
my dynamic types in such a way that they are set up in memory exactly like
C++ would set up its own objects, then I should be able to pass pointers to
them as parameters in far calls to C++ functions and the C++ functions
shouldn't know the difference. Right? (I already know this is true with
simple structures, because that's how I'm invoking OS calls.) And continuing
along this path, if I compile into the C++ host a template expansion of say,
an STL vector or a map that has as its value type paramater a pointer to
some class, then I should be able to generate my own forth types in such a
way that they are set up in memory as though they inherited from this base
class type. And I should be able to pass instances pointers of these
classes in calls to the corresponding push_back() or find() functions of my
STL container classes. As long as the instance pointed to has a correctly
constructed vtable, I should be okay. Right? And the same concept should,
I'm imagining, hold true for functors that I might want to pass as
predicates to STL algorithms. And in fact, if I set up my functor objects
so that they appear correctly to derive from the actual type I specified in
the C++ template expansion, then the actual predicate functors that I pass
could be typed to be aware of the actual type of object that I passed to the
container as a value type and could do type-specific manipulations on those
objects.
I've probably lost y'all by now and of course you might ask "Why don't you
just try it and see?". Unfortuinately, I'm currently doing major surgery on
my underlying execution engine and am not in a position to test this out,
since I didn't have the foresight to preserve a working version that would
allow me to test. (Idiot!) Yet I need to decide if this approach is even
feasible as I will be specing the system out for the client over the next
few weeks and would love to have the comfort of knowing that I have
available the full expressive power of the STL in addition to my dyamic
execution engine. I realize that if my value type for the STL containers is
a pointer to something, then I will have to use proper iterators that are
able to call comparison functions and the like dynamically (Boost has this
already, I believe). I also realize that this totally violates the spirit
of compile-time template expansion type safety. But given my circumstances,
I don't think I should have to give up the STL just because my needs are a
little exotic.
Whoever's still with me, thanks very much for slogging through this. I'd
appreciate very much some informed view of the feasibility of what I've
described here. And if you feel really charitable, any insights into how to
generate well-formed objects with correctly formulated vtables would also be
lovely.
Thanks and best wishes to all,
Michael Clagett Tag: Change Window Border color Tag: 245730
Programming for Outlook Express
I know there are programs that interact with Outlook Express (mostly
anti-spam ones) but am curious as to how I can make a program that will
interact with OE. Looking so hard on Google, and the best I came up with
was for C#, but I am just C...no C++, no C#, just C.
Is there any hope for me? Abd if there is, could you provide the link too?
Thank Tag: Change Window Border color Tag: 245729
Internal Compiler error in MSVC++
Using MSVC++ 7.1.3088
I have been getting an Internal Error (contact MS tech support) from my VC++
compiler lately. I finally figured out what causes it.
Suppose I have a class X, then the compiler has a problem with the following
lines of code:
typedef X Y;
class Y;
The forward declare of "class Y" should be treated as a redefinition of Y,
but it confuses the compiler and causes the Internal Error message.
Is this a known bug? Can it be fixed in the next version?
From,
Stephen R Mercer
-= LabVIEW R&D =-
National Instruments Tag: Change Window Border color Tag: 245726
How to call placement delete operator ?
HI, Is there any way I can call placement delete operator ?
Maybe somehow
thanks...
a.a.cpp Tag: Change Window Border color Tag: 245713
[error lnk 2001]
hello
i got the following linking error :
error LNK2001: unresolved external symbol "public: __thiscall
kplAnonKernFromCndKern::kplAnonKernFromCndKern(class std::list<class
kplVariable *,class std::allocator<class kplVariable *> > const &,class s
td::list<class kplVariable *,class std::allocator<class kplVariable *> >
const &,class kplExternalProbFunction *,class plDataValues const &)"
(??0kplAnonKernFromCndKern@@QAE@ABV?$list@PAVkplVariable@@V?$allocator@PAVkplVariable@@@std@@@std@@0PAVkplE
xternalProbFunction@@ABVplDataValues@@@Z)
Debug/test2.exe : fatal error LNK1120: 1 unresolved externals
and i'm wondering if this is due to the lack of a specific library abd
how to determine which library is missing?
Thanks
François Tag: Change Window Border color Tag: 245708
Writing a library in C
I am looking for some example how to write a dll in pure C, not C++. As a
compiler and IDE I've got Visual C++ 5 installed. Any tips? Tag: Change Window Border color Tag: 245706
waveOutOpen
I made a post earlier about trying to write my own sound control (within my
app). through a few of the replies I did find "waveOutOpen" and it's other
functions. but i can't see the correct way to use "waveOutOpen". my pc
only has one audio device, and i just need my app to be able to open the
standard volume on any flavor of windows, and change it.
i only knnow C, not C++ so please keep that in mind.
can anyone else give me some tips or point me in the right direction?
thanks Tag: Change Window Border color Tag: 245697
Someway to let new & new[] do not allocate storage !!!
Hi,
Is there some way to not to allow new operator to allocate storage..somehow
maybe if it can be done....
Thanks,
a.a.cpp Tag: Change Window Border color Tag: 245695
number of days between dates
Is there a good simple method of calculating the difference between dates? I
have strings of yyyymmdd, and want to do something like 20050304 - 20050223,
and get the number of days between those two dates.
I thought about creating a whole date class, but is there an easier method?
Like maybe creating just one function.
string sdate1 = "20050203";
string sdate2 = "20050201";
string date = date1 .substr(6.2);
int ndate1 = atoi(sdate1.c_str());
date = date2 .substr(6.2);
int ndate2 = atoi(sdate2.c_str());
//calculate how many days are missing
days = ndate1 - ndate2 ;
but this just does the dd part, maybe someone can post some code, ideas to
help.
thanks. Tag: Change Window Border color Tag: 245681
IViewObject::Draw in Internet Explorer
hi
Im loading HTML content in a hidden Internet Explorer
control and redirect the painting messages in a Memory
Device context for other uses.
So far here's what i did :
I selected a DIBSECTION in a HDC and with a timer ,
i use the IViewObject::Draw of the document
object to draw in my HDC. But the problem is
for exemple, when other objects have compound document
like IFRAME or FLASH objects.
Is there a way to get a hook the main document 's drawing
proceedure ? In other words, can i subclass a message somewhere
and dispense of the (Timer + IViewObject::Draw) combo ?
BEcause obviously the (Timer + IViewObject::Draw) forces the
docuemtn to draw TWICE !!!
thanks Tag: Change Window Border color Tag: 245664
How to Disable Debug?
I recently installed C++ 6.0 (old, I know)... and I said "Yes" when it
asked about adding debug information to Windows or SDK (or something
like that). The unfortunate side-affect has been that when the server
program I run crashes, a dialog box now pops up demanding user
interaction to allow the process to die or "cancel and debug." This
would be fine if Visual Studio was running, but it's not--I only want
this sort of crash interception to occur when I'm in Visual Studio. As
it stands now, the watchdog process to restart my server when it
crashes is effectively nerfed because it needs to run unattended, but
the debug dialog box demands a user be present. :(
I un-installed all components and this crash intercept debug feature
still persists. Unfortunately I didn't save a backup of my Windows
folder before the install (which would have made undoing this much
easier). I found some information on Microsoft's site about retail and
debug versions of the SDK, but it was for an older version of DirectX.
Given that background, how do I disable this crash debug feature?
Thanks,
~Bonesly Tag: Change Window Border color Tag: 245647
DDEConnect question
I'm using the DDEConnect function and when I call it with no DDE server in
action the code run inside itself and don't return. I think that the normal
think is that if the function fall it have to return a code in a bit. I call
the funcion like this:
hconvCppServer = DdeConnect(m_InstId, hszCppServer, hszCppTopic, 0);
All the function parameters are valid.
In anyway if I use the function with a valid DDE server it work fine.
Can you explain me how is possible this? Tag: Change Window Border color Tag: 245644
May STL destructors throw?
The C++ standard says (17.4.4.8/3): "No destructor operation defined in
the C++ Standard Library will throw an exception."
It also does not put an excception specification for
basic_string::~basic_string() (21.3/6, pp. 385).
Is this NOT a contradiction? May the basic_string dtor throw or not? Tag: Change Window Border color Tag: 245639
PrintDlg() method : hDevMode and hDevName help
Hello all,
My code seems to be working, however I have a question about the
returned PRINTDLG::hDevMode and PRINTDLG ::hDevName fields.
//****Code***
PRINTDLG g_PrintDlg; //hDevMode and hDevNames = NULL
DEVMODE *pdv;
BOOL bRetVal, bColor;
TCHAR m_szPrinterName[32];
if(bRetVal = PrintDlg(&g_PrintDlg))
{
...
if(g_PrintDlg.hDevMode != NULL)
{
pdv = (DEVMODE *) GlobalLock(g_PrintDlg.hDevMode);
lstrcpy(szPrinterName, (LPSTR) pdv->dmDeviceName);
bColor = (DMCOLOR_COLOR == pdv->dmColor);
GlobalUnlock(g_PrintDlg.hDevMode);
}
...
// When I free the global memory (below), a second call to
// PrintDlg() will cause an insufficient memory error. When I
// do not free the memory, everything works fine with repeated
// calls to PrintDlg().
if(g_PrintDlg.hDevMode != NULL)
GlobalFree(g_PrintDlg.hDevMode);
if(g_PrintDlg.hDevNames != NULL)
GlobalFree(g_PrintDlg.hDevMode);
...
}
Question : If I do not free the global memory, will this code create a leak
or
is there a mechanism which frees the memory that I couldn't find in MSDN?
Thank You - M Tag: Change Window Border color Tag: 245637
Which has higher precedence & or ==
I have this example in a window procedure:
fBlocking is BOOL and wParam is an argument of the window procedure.
switch (iMsg){
//
case WM_CHAR:
if (fBlocking & wParam =3D=3D '\x1B'){
//
}
retrurn 0;
//
}
Like this we get a warning:
warning C4554: '&' : check operator precedence for possible error; use =
parentheses to clarify precedence
But I don't know what the precedence was expected here to put the parens =
in correctly.
Any ideas?
--=20
George Hester
_________________________________ Tag: Change Window Border color Tag: 245625
Simpel WIN32 Message box
Hi, i got a problem.
I've got VS2005 Beta 1 installed, and the newest platform SDK.
I'm a newbie in the WIN32 Programming. but if i try to compile this piece of
code:
#define WIN32_LEAN_AND_MEAN
#include <windows.h> // the main windows headers
#include <windowsx.h> // a lot of cool macros
int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hprevinstance, LPSTR
lpcmdline, int ncmdshow)
{
MessageBox(NULL, "THERE CAN BE ONLY ONE!!!", "MY FIRST WINDOWS PROGRAM",
MB_OK | MB_ICONEXCLAMATION);
return(0);
}
The compiller gives this error back:
Linking...
main.obj : error LNK2019: unresolved external symbol __imp__MessageBoxA@16
referenced in function _WinMain@16
Debug/Game_02.exe : fatal error LNK1120: 1 unresolved externals
Build log was saved at "file://c:\Documents and Settings\Administrator\Mijn
documenten\Visual Studio\Projects\Game_02\Game_02\Debug\BuildLog.htm"
Game_02 - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Anyone knows how to solve this problem? I really like the compilers GUI, and
i want to learn on this compiler :) Tag: Change Window Border color Tag: 245610
SetWindowWord()
I have this in a Window procedure in a C program:
SetWindowWord(hwnd, 0, 1^GetWindowWord(hwnd, 0));
hwnd is a handle to a CreateWindow done earlier. Now this gives a =
Warning C4761: integral size mismatch in argument; conversion supplied. =
So this is my fix:
SetWindowWord(hwnd, 0, (WORD)(1^GetWindowWord(hwnd, 0)));
I'm wondering if this would be the correct way to get rid of C4761 and =
why don't I still get the warning since 1 is a long and GetWindowWord is =
an unsigned short? Like 1L would be a long 1 is there a (WORD)1?
--=20
George Hester
_________________________________ Tag: Change Window Border color Tag: 245606
where is thye bext place to buy MSDN subscription?
Hello,
I want to buy a MSDN subscription. Where is the best place to buy it.
I found that OSROnline selling it a little chaper than microsoft itself. Is
there any other place that sell it cheaper?
Best regards Tag: Change Window Border color Tag: 245597
Boolean returns
I have a routine that I want to return a boolean value from, i.e:
DLL_API bool STDCALL MyRoutine(HWND hWnd)
{
//some code...
return true;
}
This routine is in a dll which I'm calling from a VB exe. Sometimes the
routine returns true when it clearly shouldn't have. The routine is quite
simple with a few if's and some &'s and |'s. Anyhow, the code is not
important because I can easily do a dry-run in my head, but the routine is
not consistent in it's return values. I also use the PrintWindow api which
returns a boolean which can't be relied on in c++. I know my routine works
ok, because if I return an int instead, so return 1 is true and return 0 is
false, everything is fine. Is there a problem with transferring boolean
results from a c++ dll to a vb exe? Or is there something I've missed here? Tag: Change Window Border color Tag: 245595
copying data
Hi,
I wrote the following code:
BYTE *pBuffer = new BYTE[MYBUFFERSIZE];
//[...] filling buffer with data...
BYTE *currpos = NULL;
UINT offset = 20;//random value, smaller than MYBUFFERSIZE, of course
currpos = &pBuffer[offset]; //creates a pointer to pBuffer increased by 20
bytes
This statement compiles fine, but when I run it, I find the first 4 bytes
currpos points to corrupted (these 32bits contain the pointers address).
Obviously, I'm casting a wrong way, but I cannot figure out what exactly I'm
doing wrong....can anyone help?
Thanks
Peter Tag: Change Window Border color Tag: 245592
Runtime libraries
In VC++ environment are C, C++ and win32 API in separate libraries/files?
What are the filenames for each of them? Tag: Change Window Border color Tag: 245591
newbie: Addition of vars
Hi,
just one question: What's the difference between:
int a;//replace int by any value or class that supports this
int b;
a = a + b;
versus
a += b;
Is there any performance difference?
Thanks
Peter Tag: Change Window Border color Tag: 245587
A silly question
Hi All,
If there are two classes, they both have a pure virtual function which
the signatures are exactly same. Now, can I implement & invoke them
respectively if another class extends them at the same time?
For example:
class A {
virtual void Func(void) = 0;
};
class B {
virtual void Func(void) = 0;
};
class C : public B, public A {
void Func(void);
};
Thanks in advance,
Best Regards,
Elliott Tag: Change Window Border color Tag: 245580
Mouse hooks
I have a neat little dll that allows resizing and dragging by clicking
anywhere on the window (pressing ALT at the same time). However, I noted
something interesting. If I click the title bar, my dll does nothing. Does
clicking the titlebar prevent mouse hooks? If so, what would be a way around
it, if there is one? Tag: Change Window Border color Tag: 245579
what do I need to develop applications for win64?
Hello,
What do I need to develop applications for win64 on AMD64 or Intel Xeon
processors? Can I do this with MSVC 2003? what about MSVC 2005?
Best regards Tag: Change Window Border color Tag: 245576
Passing a vector to a function
Hi;
Is it possible for to pass a vector into a function and access the
elements of the vector inside that function? I tried but I am getting an
error, so please help!
// the following is what I am trying to do but seems like there is sothing
I am missing.
void readFile(char * fileName)
{
ifstream inFile(fileName);
vector<char> doc;
while (!inFile.eof())
{
char ch[1];
inFile.read(ch,1);
do.push_back(ch[0]);
}
inFile.close();
compareAndProcess(doc);
}
void compareAndProcess(char doc[])
{
vector<char>::iterator iter;
for (iter = doc.begin(); iter < doc.end(); iter++)
// process each character
}
When I compile Iam getting the follwoing error:
error C2228: left of '.begin' must have class/struct/union type
error C2228: left of '.end' must have class/struct/union type
So, could someone please explain if it is even possible to do; if it is
possible what changes do I need to make so that it will compile.
thanks in advance.
JP Tag: Change Window Border color Tag: 245570
"Command Arguments" redirection failure in IDE
I'm using VS 2003 and have 2 separate simple console projects. One has one
source file (main.cpp), which I use for developing simple C++ programs and
the other has one source file (main.c), which I use for developing simple C
programs. I've written a simple C++ program using the cin.get and cout.put
and an equivalent C program using getchar and putchar. In both programs I've
setup the "Command Arguments" field of the debug properties for command
redirection of stdin using "<\infile" (no actual double-quotes, of course) .
The strange thing (to me, at least) is that it works correctly for the C++
version, but completely ignores the redirection in the C version and simply
sits there waiting for me to enter something from the keyboard. If I run the
programs from a command window they both work as expected when redirected. I
know I've gotten this to work in the past so I can't help thinking there must
be some subtle thing I have setup incorrectly in the C project. Tag: Change Window Border color Tag: 245569
Questions about fopen and printers
This is more of a theoretical question.
is it possible to use fopen() and fprintf() to send basic text to a printer
through the printer's USB port?
I guess my real question is, can I use a printer's USB input port as a
simple serial port the same way fopen("COM1:", "w") does?
thanks in advance,
ed Tag: Change Window Border color Tag: 245564
About loading an image
Hi Group,
I'm going to load an image file into memory and modify it then write it out.
Please consider this couldn't be using Microsoft classes. The code should be
running under both
windows and linux so I have to go with standard C++.
What classes should I consider to do thing in terms of array and memory
managment?
Any suggestions on this?
Thanks in advance, Tag: Change Window Border color Tag: 245559
Efficient File Processing
I've written a little utility program that reads binary data (from a file) in
big endian format and converts it to little endian. Unfortunately, the size
of the file(s) that I typically deal with are quite large (~400MB). I've
chosen to read the data using the read() method of the fstream class (I
actually read the entire contents of the file into a Byte array...not
byte-by-byte or "pieces" at a time). It takes my application a little longer
to run than I'd like...is there a better way to access this data than the
implementation I've chosen?
Here's an example of how I read the data:
ifstream faic;
filebuf* fbuf;
faic.open(argv[1], ios::binary);
fbuf = faic.rdbuf();
//get file size
filesize=fbuf->pubseekoff (0,ios::end,ios::in);
fbuf->pubseekpos (0,ios::in);
//allocate byte array
b = new byte[filesize];
//read data into b
faic.read(b, filesize);
faic.close(); Tag: Change Window Border color Tag: 245534
Working with Visual C++ Toolkit 2003
Hello!
I need some advice concerning the Visual Toolkit 2003. I have been working
with Visual C++ 6.0 Professional for several years now, and I am still using
it for a running project. Unfortunately, VC++ 6.0 is rather out of date and
I am having some trouble with its lack of conformance to the C++ standard.
Visual C++ .NET turned out to be rather expensive, especially for the reason
that the Professional Edition is not available as a stand-alone any more,
only together with the rest of Visual Studio. I guess that this is their way
of selling that Visual Basic and Visual J crap that nobody wants to have -
well, thanks Microsoft...
This more or less forced me to take a look at the Visual C++ Toolkit 2003. I
have downloaded and installed it, and it basically works fine. However, I
cannot imagine that it is at all possible to build a large-scale project
from the command line. The ReadMe file include some link to internet
resources on using the Toolkit, but I have checked them out and they are
nothing but useless. Other so-called "tutorials" only provide an
installation guide and tell you how to compile a "hello world" application.
Is anyone out there seriously using the Toolkit for their projects? If so,
how do you use it? Are you working with Notepad or with a custom IDE? Are
you using makefiles, or are you typing a dozen of commands each time you
compile? How do you set your path variables? When I type "cl" into a DOS
prompt, all I get is an error because the command cannot be found... Sorry,
but I don't even know where to start - or maybe I shouldn't do so anyway,
but rather throw the Toolkit away and get the full version?
Best regards,
Matthias Hofmann Tag: Change Window Border color Tag: 245533
HELP:CreateInstance Failing
Hi guys,
I haven't gotten any luck with this yet so ny suggestion or help is really
appreciated.
I have a COM exe server from which I'm trying to create an instance of
SQLServer object so I use this:
if(SUCCEEDED(OleInitialize(NULL)))
{
try
{
CoInitialize(NULL);
_SQLServerPtr spSQLServer;
HRESULT hr2 = spSQLServer.CreateInstance(__uuidof(SQLServer));
if (FAILED(hr2))
_com_issue_error(hr2);
The problem is CreateInstance always fails with this error : Class not
Registered error number : -2147221164
When I try the same method in an MFC API it works fine...
Is it possible that being in a COM and instantiating another COM is a
problem??
Thanks guys. Tag: Change Window Border color Tag: 245529
ocx callback function convert VC++ to VB6
Hi all,
I'm using a 3rd part component (ocx) in vb6 and I have an example (see
below) in VC++ how to use a callback function.
I need to convert that example in VB6, any help would be appreciate.
Thanks,
Juky
.......
// define callback function.
int GetBuffer(int s, int w, int h, LPBYTE p)
{
... // any code
return 0;
}
......
myOCX.SetCallBack((long)GetBuffer); Tag: Change Window Border color Tag: 245528
access to fonctions in the main application from dlls
Hello,
I am trying to have a set of functions (and variables)
that I can access both from several dlls and from the core application.
Right now, i am building a static library with these functions,
but this same lib is loaded several times (in the core app and in each
dll).
To avoid that, does it make sense to build a dll rather than a static
lib ?
i.e. can I be sure that the dll will be loaded once only ?
Is there a better solution such as exporting functions (and variables)
directly from the core application rather than through this
"in-between" lib ?
Can you tell me how to proceed ?
Thanks
yomgui Tag: Change Window Border color Tag: 245526
get iocontrol code constants of NDIS IM using C#
Hello,
I'm try to access the extended Passthru from
http://www.wd-3.com/031504/PTEx3_index.htm using C#.
Any body know how to get the correct iocontrol codes of :
IOCTL_PTUSERIO_ENUMERATE = ?;
IOCTL_NDISPROT_OPEN_DEVICE = ?;
There is an example using with ndisprot protocol driver:
http://www.codeproject.com/csharp/SendRawPacket.asp?df=100&forumid=25245&select=1082543
// iocontrol code constants
private const uint IOCTL_NDISPROT_QUERY_BINDING = 0x12C80C;
private const uint IOCTL_NDISPROT_OPEN_DEVICE = 0x12C800;
howee i dont khnow this codes from where ? Tag: Change Window Border color Tag: 245521
odd first character from read(0,...)
Given this trivial little snippet,
#include <stdio.h>
int
main()
{
char ch1,ch2;
_sleep(1000);
printf("? ");
read(0,&ch1,1);
read(0,&ch2,1);
printf("%c%c\n",ch1,ch2);
return 0;
}
I'm seeing behavior that I'm at loss to explain:
c:\src> cl /o curious.exe foo.c
...
c:\src> curious
<type in 'a' prior to appearance of prompt>
? ax
fx
c:\src> curious
<delay typing anything until prompt appears>
? ax
ax
c:\src>
Why is the first character in the type-ahead case reported as 'f'?
Same behavior seen when compiling with /MD (cl.exe's version string
is 12.00.8804)
Anyone know if this is a known issue and/or there is a workaround?
(unfortunately, I'm stuck with using read() in the app that this
snippet has been extricated from.)
cheers
zeb Tag: Change Window Border color Tag: 245514
I want to change the color of the border of a window. Will someone
point me to the a call that will do that?