|
Considering wat u said i changed the PROCESS_ALL_ACCESS to PROCESS_TERMINATE and tried it but again it failed so now i guess only option left is setting SeDebugPrivilege....now i really dont have a clue how to do it....please suggest me a way out of it
|
|
|
|
|
Hi,
I have created a SDI application in vc++6, mfc. I have to place a bitmap in the CView. Please can to tell me how to do this?
Thanks,
Tara
Fortitudine Vincimus!
|
|
|
|
|
Use BitBlt in the OnPaint method.
|
|
|
|
|
You can use one of the image controls provided on this site.
Create them as child window of the view. In the views OnSize, resize the child also.
To avoid flicker, override WM_ERASEBKND and do nothing, returning true.
I've written an article trying to detail everythign yu have to take care of when showing a buitmap (plus a few features) here: WndImage Control[^]
But there are controls with more features available on this site.
|
|
|
|
|
Thanks.
Actually I have a crazy client who likes the splash screen a lot. He wants the splash screen to remain on the screen. I thought the best way to do this would be to draw it in the CView. Is it correct?
Fortitudine Vincimus!
|
|
|
|
|
you can use BitBlt or StretchBlt or Graphics::DrawImage in
WM_PAINT or WM_ERASEBKGND also you can use form a control and set your image to this control
|
|
|
|
|
Thanks.
I have done it. I uses BitBlt in WM_PAINT. Its come out good.
Fortitudine Vincimus!
|
|
|
|
|
Can anyone suggest a good design pattern for designing an invoicing program, such as a very stripped down version of Qbooks. Please excuse me if I posted in the wrong forum, but my project is C++
|
|
|
|
|
For the invoices, what you usually need to do is split it into two parts: the invoice head, and associated rows. The invoice head typically contains information about the invoice as a whole such as invoice number, references, possibly order number references, billing and shipping adresses, invoice status, etc. The rows contain information about the invoiced products and services, but also meta-information such as free text, etc. Since the order of how information is presented on an invoice may be important (most usually is, as some rows such as rebates, etc, depend on other rows), it is easiest to incorporate this ordering into the underlying datastructure. It's easily solved using by tagging each row with a unique row number, identifying the row's position from the top of the printed invoice. This usually maps very well to a database design, thus making it easier to persist/unpersist the invoice from/to database with minimal effort in terms of lines of code.
As for all the other stuff that comes with an invoicing program, this forum is too small to even scratch the surface. It very much depends on how much functionality you want in your program. What search functionality do you want to offer? You might also want to add a customer register, as well as product register. With that comes other posibilities such as "how much does customer X pay for product Y?" - price list management. And of course, you'll most likely want to extract information from the application - mail printouts, PDFs for email, etc. Do you want to be able to interface the app to a book keeping system? The list goes on and on.
--
Mr. Bender's Wardrobe by ROBOTANY 500
|
|
|
|
|
how to mix two pcm data?
is there any method in VC++?
or any simple algorithm?
i hav read secondary and primary buffers used for o/p buffer.
but i dont know how to handle them efficiciently.
can anyone help me?
http://www.engineeringproject.net
|
|
|
|
|
very urgent
http://www.engineeringproject.net
|
|
|
|
|
I am writing a template container class similar to a vector or list. I am optimizing the class for performance not size. I want to know between the two examples relatively speaking how much faster example 2 is than 1.
Since the functionality employed within the loops is simple, it stands to reason the conditional testing (in the while clause) is relatively speaking measureable (from a performance standpoint......as compared to a loop where complex assignments are occurring.
Example 1:
T* dst1; //is pointing to legitimate memory address.
T* src1; //is pointing to legitimate memory address.
T* dst2; //is pointing to legitimate memory address.
T* src2; //is pointing to legitimate memory address.
T* stop = dst1 - 1000000; //is pointing to legitimate memory address as part of the same array dst points to.
while (dst1-- > stop){
*dst1 = *--src1;
}
stop = dst2 - 1000000;
while (dptr2-- > stop){
*dst2= *--src2;
}
Example 2:
T* dst1; //is pointing to legitimate memory address.
T* src1; //is pointing to legitimate memory address.
T* dst2; //is pointing to legitimate memory address.
T* src2; //is pointing to legitimate memory address.
T* stop = dst1 - 1000000; //is pointing to legitimate memory address as part of the same array dst points to.
while (dst1-- > stop){
*dst1= *--src1;
*--dst2= *--src2;
}
Obviously 2 is faster, but by how much?? In other words compared to the increment operations dereferencing and assigning of memory addresses, how much does the 1000000 conditional tests affect performance compared to the 1000000 of each operations occurring in the loop.
Thanks
|
|
|
|
|
Without knowing the microprocessor architecture + compiler optimization specifics, it's hard to give a "how much" answer.
Working off a super-simplified instruction set, the first example can be generalized to the following. We'll assume that the architecture has branch prediction and that compiler optimization has rearranged the memory accesses so they effectively take just one spot in the pipeline.
loop 1
x1 million:
decrement dst1
compare/branch dst1 to stop
decrement src1
read memory at src1
write memory at dst1
loop 2
x1 million:
decrement dst2
compare/branch dst2 to stop
decrement src2
read memory at src2
write memory at dst2
Second example
loop
x1 million:
decrement dst1
compare/branch dst1 to stop
decrement src1
read memory at src1
write mem at dst1
decrement src2
decrement dst2
read mem at src2
write mem at dst2
With this oversimplification, the second example will run at 9/10 the time of the first.
If the memory accesses are the limiting factor in performance, then the difference between the examples will be negligible. Also, depending on the size of the data and the amount of physical memory available to your process, the first one example might possibly run faster since it better obeys the principle of spatial locality.
If branching policy is the limiting factor, then the second example would perform even better (as in less time) than 9/10 the time of the first, since it has 1 million less branch instructions.
Best way to check is to implement both and time a few typical data runs through both.
FTS Technology Solutions
|
|
|
|
|
Hi,
I'm trying to overlay opengl onto a mfc bitmap. However, im getting the bitmap appearing for one frame before being replaced by the gl, even when i dont use glClear().
Im trying using both StretchDIBits() and a vfm windowless webcam stream, and work up until the opengl is applied, when i get the flickering.
This is the current proccess:
get bitmap / stream
glClear
draw bitmap using StretchDIBits()
draw gl scene
swapbuffers
It seems as if its an issue with the mfc bitmap automatically swapping buffers (i need to use double buffering at least) before the gl is drawn. Ive tried every combination of the above, and still cant get my head around it! If anyone has any ideas, id greatly appreciate it.
Thanks in advance,
Adam Vanner
-- modified at 12:49 Saturday 22nd July, 2006
|
|
|
|
|
im having tremendous difficulty in trying to alter some code. I need what is basically a console chat application between a client and a server implemented using a named pipe. I'm not going to re-list code which is found a hundred times already on this site although none of them seem to do specifically what im asking for. Can anyone help?...please!!!
If i'm not dead enough for life, am i alive enough for death?
|
|
|
|
|
eeyor666 wrote: Can anyone help?...please!!!
which code are you using!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
the following is all .cpp and all .h files i have used.
<pre>//*******************************************************************************************
// CLIENTNP.CPP
/* client/server program CLIENT
clientNP connection-oriented client*/
/* execute a command line(on the server);display the response
client creates a long-lived connection with the server(consuming a pipe instance)
and prompts user for a command*/
#include "EvryThng.h"
#include "ClntSrvr.h" //defines the request, records
int _tmain(int argc,LPTSTR argv[])
{
HANDLE hNamedPipe = INVALID_HANDLE_VALUE;
TCHAR PromptMsg[] = _T("\nEnter Command: ");
TCHAR QuitMsg[] = _T("$Quit");
TCHAR ServerPipeName[MAX_PATH];
REQUEST Request; //see ClntSrvr.h
RESPONSE Response; //see ClntSrvr.h
DWORD nRead, nWrite, NpMode = PIPE_READMODE_MESSAGE | PIPE_WAIT;
LocateServer (ServerPipeName);
//wait for an NP instance and "race" to open it.
while (INVALID_HANDLE_VALUE == hNamedPipe{
WaitNamedPipe (SeverPipeName, NMPWAIT_WAIT_FOREVER);
hNamedPipe = CreateFile (ServerPipeName,
GENERIC_READ | GENERIC_WRITE, 0, NULL,
OPEN_EXISTING, FILE ATTRIBUTE_NORMAL, NULL);
}
//SET NP HANDLE TO BLOCKING, message mode
SetNamedPipeHandleState(hNamedPipe, &NpMode, NULL, NULL);
//prompt user for commands. Terminate on "$QUIT."
while (ConsolePrompt (PromptMsg, Request.Record,
MAX_RQRS_LEN, TRUE)
&&(_tcsmcmp (Request.Record, QuitMsg) !=0)){
WriteFile (hNamedPipe, &Request, RQ_SIZE &nWrite, NULL);
//read each response and send it to std out
//Response.Status == 0 indicates "end of response."
while (ReadFile (hNamedPipe, &Response, RS_SIZE,
&nRead, NULL)&&(Response.Status == 0))
_tprintf(_T("%s"),Response.Record);
}
_tprintf(_T("Quit command recieved. Disconnect."));
CloseHandle(hNamedPipe);
return 0;</code>
}
//*********************************************************************************************************
// SERVERNP.CPP
/* multithreaded command line server. Named pipe version*/
#include "EvryThng.h"
#include "ClntSrvr.h" /* Request and response message definitions*/
typedef struct{ /* argument to a server thread. */
HANDLE hNamedPipe; /* Named Pipe Instance */
DWORD ThreadNo;
TCHAR TmpFileName [MAX_PATH]; /* Temporary file name */
} THREAD_ARG;
typedef THREAD_ARG *LPTHREAD_ARG;
volatile static BOOL ShutDown = FALSE;
static DWORD WINAPI Server (LPTHREAD_ARG);
static DWORD WINAPI Connect (LPTHREAD_ARG);
static DWORD WINAPI ServerBroadcast (LPLONG);
static BOOL WINAPI Handler (DWORD);
static TCHAR ShutRqst [] = _T ("$ShutDownServer");
_tmain (int argc,LPTSTR argv []);
{
/* MAX_CLIENTS is defined in ClntSrvr.h */
HANDLE hNp, hMonitor, hSrvrThread [MAX_CLIENTS];
DWORD iNp, MonitorId, ThreadId;
LPSECURITY_ATTRIBUTES pNPSA = NULL;
THREAD_ARG ThArgs [MAX_CLIENTS];
/* Console control handler to permit server shutdown */
SetConsoleCtrlHandler (Handler, TRUE);
/* Create a thread broadcast pipe name periodically */
hMonitor = (HANDLE) _beginthreadex (NULL,
0,
ServerBroadcast,
NULL,
0,
&MonitorId);
/* Create pipe instance & temp file for every server thread. */
for (iNp = 0; iNp < MAX_CLIENTS; InP++){
hNp = CreateNamedPipe (SERVER_PIPE,
PIPE_ACCESS_DUPLEX,
PIPE_READMODE_MESSAGE | PIPE_TYPE_MESSAGE | PIPE_WAIT,
MAX_CLIENTS,
0,
0,
INFINITE,
pNPSA);
ThArgs [iNp].hNamedPipe = hNp;
ThArgs [iNp].ThreadNo = iNp;
GetTempFileName (_T("."),_T("CLP"),0,ThArgs [iNp].TmpFileName);
hSrvrThread [iNp] = (HANDLE)_beginthreadex (NULL, 0, Server, &ThArgs [iNp], 0, &ThreadId);
}
/* Wait for all threads to terminate */
WaitForMultipleObjects (MAX_CLIENTS,
hSrvrThread,
TRUE,
INFINITE);
WaitForSingleObject (hMonitor, INFINITE);
CloseHandle (hMonitor);
for iNp = 0; iNp<MAX_CLIENTS; iNp++){
/* Close pipe handles and delete temp files. */
CloseHandle(hSrvrThread [iNp]);
DeleteFile (ThArgs [iNp].TmpFileName);
}
_tprintf (_T("Server Process has shut down.\n"));
}
//***********************************************************************************
static DWORD WINAPI Server (LPTHREAD_ARG pThArg)
/* Server thread function; one for every potential client. */
{
HANDLE hNamedPipe, hTmpFile = INVALID_HANDLE_VALUE,
hConTh, hClient;
DWORD nXfer, ConThId, ConThStatus;
STARTUPINFO StartInfoCh;
SECURITY_ATTRIBUTES TempSA =
{sizeof (SECURITY_ATTRIBUTES), NULL, TRUE};
PROCESS_INFORMATION ProcInfo;
FILE *fp;
REQUEST Request;
RESONSE Response;
GetStartupInfo (&StartInfoCh);
hNamedPipe = pThArg->hNamedPipe;
hTmpFile = CreateFile (pThArg->TmpFileName,
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
&TempSA,
CREATE_ALWAYS,
FILE_ATTRIBUTE_TEMPORARY,
NULL);
while (!ShutDown){ /* Connection Loop */
/* Create connection thread; wait for it to terminate */
hConTh = (HANDLE)_beginthreadex (NULL,
0,
Connect,
pThArg,
0,
&ConThId);
/* Wait for a client connection & test shutdown flag */
while(!ShutDown && WaitForSingleObject (hConTh, CS_TIMEOUT)==WAIT_TIMEOUT)
{/* EMPTY LOOP BODY */};
if (ShutDown) continue; /*Flag can be set by any thread */
CloseHandle (hConTh);
/* A CONNECTION NOW EXISTS */
While (!ShutDown && ReadFile
hNamedPipe, &Request, RQ_SIZE, &nXfer, NULL)/*should there be another bracket here?*/{
/* Recieve new commands until the client disconnects */
ShutDown = ShutDown ||
(_tcscmp (Request.Record, ShutRqst)==0);
if (ShutDown) continue; /* Tested on each iteration*/
/*Create a process to carry out the command*/
StartInfoCh.hStdOutput = hTmpFile;
StartInfoCh.hStdError = hTmpFile;
StartInfoCh.hStdInput = GetStdHandle (STD_INPUT_HANDLE);
StartInfoCh.dwFlags = STARTF_USESTDHANDLES;
CreateProcess (NULL,
Request.Record,
NULL,
NULL,
TRUE, /*INHERIT HANDLES*/
0,
NULL,
NULL,
&StartInfoCh,
&ProcInfo);
/* Server Process Is Running */
CloseHandle(ProcInfo.hThread);
WaitForSingleObject(ProcInfo.hProcess, INFINITE);
CloseHandle(ProcInfo.hProcess);
/* Respond line at a time. It is convenient to use C
Library line-oriented routines at this point */
fp= _tfopen(pThArg->TmpFileName, _T("r"));
Response.Status = 0;
while (_fgetts(Response.Record, MAX_RQRS_LEN, fp!=NULL)
WriteFile (hNamedPipe,
&Response,
RS_SIZE,
&nXer,
NULL);
FlushFileBuffers (hNamedPipe);
fclose(fp);
/* erase temp file contents */
SetFilePointer (hTmpFile,
0,
NULL,
FILE_BEGIN);
SetEndOfFile(hTmpFile);
/* Send an end of response indicator. */
Response.Status = 1; strcpy(Response.Record, "");
WriteFile (hNamedPipe,
&Response,
RS_SIZE,
&nXfer,
NULL);
}
/* end of main command loop. Get next command */
/* Shut down active connection thread */
GetExitCodeThread (hConTh, &ConThStatus);
if (ConThStatus == STILL_ACTIVE){
hClient = CreateFile(SERVER_PIPE,
GENERIC_READ | GENERIC_WRITE,
0,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL);
if (hClient != INVALID_HANDLE_VALUE)
CloseHandle (hClient);
WaitForSingleObject (hConTh, INFINITE);
}
/* Client disconnected or there is a shutdown request */
FlushFileBuffers (hNamedPipe);
DisconnectNamedPipe (hNamedPipe);
}
/* end of command loop. Free resources; exit from the thread */
if (hTmpFile != INVALID_HANDLE_VALUE)
CloseHandle (hTmpFile);
DeleteFile (pThArg->TmpFileName);
_tprintf(_T("Exiting thread number %d\n"), pThArg->ThreadNo);
_endthreadex(0);
}
static DWORD WINAPI Connect (LPTHREAD_ARG pThArg)
{
/* connection thread allowing server to poll shutdown flag */
ConnectNamedPipe(pThArg->hNamedPipe, NULL);
_endthreadex(0);
return 0;
}
BOOL WINAPI Handler (DWORD CtrlEvent)
{
/* shut down the system */
ShutDown = TRUE;
return TRUE;
}
//***************************************************************************************************
// EvryThng.h
/* EvryThng.h -- all standard and custom include files*/
#include "Exclude.h" /* excludes definitions not required by the sample program*/
#include "envirmnt.h"
#include <windows.h>
#include <tchar.h>
#include <stdio.h>
#include <io.h>
#include "support.h"
#ifdef _MT
#include <process.h>
/* DWORD_PTR (pointer precission unsigned integer) is used for integers
* that are converted to handles or pointers.
* This eliminates Win64 warnings regarding conversion between
* 32-bit and 64-bit data, as HANDLEs and pointers are 64 bits in
* Win64. This is enabled only if _Wp64 is defined
*/
#if !defined(_Wp64)
#define DWORD_PTR DWORD
#define LONG_PTR LONG
#define INT_PTR INT
#endif
******************************************************************************************
//ClntSrvr.h
/* Definitions for Client/Server communication
* request and response messages. Messages are in ASCII as
* the request may be coming from a Windows 95 system.*/
#define MAX_RQRS_LEN 0x1000
typedef struct{
DWORD32 RqLen; //request length, not including this field
CHAR Command;
BYTE Record[MAX_RQRS_LEN];
}REQUEST;
typedef struct{
DWORD32 RsLen //repsonse length, not including this field
CHAR Status;
BYTE Record[MAX_RQRS_LEN];
}RESPONSE;
#define RQ_SIZE sizeof (REQUEST)
#define RQ_HEADER_LEN RQ_SIZE-MAX_RQRS_LEN
#define RS_SIZE sizeof (RESPONSE)
#define RS_HEADER_LEN RS_SIZE-MAX_RQRS_LEN
//mailslot message structure
typedef struct{
DWORD msStatus;
DWORD msUtilization;
TCHAR msName[MAX_PATH];
}
#define MSM_SIZE sizeof (MS_MESSAGE)
#define CS_TIMEOUT 5000 //timeout period for named pipe
//connections and perfomrnance monitoring
#define MAX_CLIENTS 10
#define MAX_SERVER_TH 4 //max num of server threads for serverNPCP
#define MAX_CLIENTS_CP 16 //max num of clients for serverNPCP
//client and server pipe & mailslot names
#define SERVER_PIPE _T("\\\\.\\PIPE\\SERVER")
#define CLIENT_PIPE _T("\\\\.\\PIPE\\SERVER")
#define SERVER_BROADCAST _T ("SrvrBcst.exe")
#define MS_SRVNAME _T("\\\\.\\MAILSLOT\\CLS_MAILSLOT")
#define MS_CLTNAME _T("\\\\.\\MAILSLOT\\CLS_MAILSLOT")
#define MX_NAME _T ("ClientServerMutex")
#define SM_NAME _T ("ClientServerSemaphore")
//commands for the statistics maintenance function
#define CS_INIT 1
#define CS_RQSTART 2
#define CS_RQCOMPLETE 3
#define CS_REPORT 4
#define CS_TERMTHD 5
//client/server support functions
BOOL LocateServer (LPTSTR);
//******************************************************************************************
//Exclude.h
// Exclude.h -- define variables to exclude selected header files.
#define WIN32_LEAN_AND_MEAN //this has the largest impact,
//halving the precompiled header(phc) file size
//the following definitions all reduce the phc and improve compiling time
#define NOATOM
#define NOCLIPBOARD
#define NOCOMM
#define NOCTLMGR
#define NOCOLOR
#define NODEFERWINDOWPOS
#define NODESKTOP
#define NODRAWTEXT
#define NOEXTAPI
#define NOGDICAPMASKS
#define NOHELP
#define NOICONS
#define NOTIME
#define NOIMM
#define NOKANJI
#define NOKERNEL
#define NOKEYSTATES
#define NOMCX
#define NOMEMMGR
#define NOMENUS
#define NOMETAFILE
#define NOMSG
#define NONCMESSAGES
#define NOPROFILER
#define NORASTEROPS
#define NORESOURCE
#define NOSCROLL
#define NOSERVICE
#define NOSHOWWINDOW
#define NOSOUND
#define NOSYSCOMMANDS
#define NOSYSMETRICS
#define NOSYSPARAMS
#define NOTEXTMETRIC
#define NOVIRTUALKEYCODES
#define NOWH
#define NOWWINDOWSTATION
#define NOWINMESSAGES
#define NOWINOFFSETS
#define NOWINSTYLES
#define OEMRESOURCE
//*****************************************************************************************
//Support.h
/* Support -- definitions of all symbolic constants and common utility functions
* IT IS BEST TO DEFINE UTILITY_EXPORTS AND STATICLIB WITHIN THE
* PROJECT RATHER THAN HERE.
* The name UTILITY_EXPORTS is generated by Dev Studio when you create
* a DLL project named "Utility" and it is defined on the C command line
*/
//UTILITY_3_0_EXPORTS is defined within the UTILITY_3_0 project
#if defined(UTILITY_3_0_EXPORTS)
#define LIBSPEC _declspec(dllexport)
#elif defined(__cplusplus)
#define LIBSPEC extern "C" _declspec (dllimport)
#else
#define LIBSPEC _declspec (dllimport)
#endif
#define EMPTY _T ("")
#define YES _T ("y")
#define NO _T ("n")
#define CR 0x0D
#define LF 0x0A
#define TSIZE sizeof (TCHAR)
//limits and constants
#define TYPE_FILE 1 //used in ls, rm and lsFP
#define TYPE_DIR 2
#define TYPE_DOT 3
#define MAX_OPTIONS 20 //max # of command line options
#define MAX_ARG 1000 //max # of command line arguments
#define MAX_COMMAND_LINE MAX_PATH+50 //max size of a command line
//commonly used functions
LIBSPEC BOOL ConsolePrompt (LPCTSTR, LPTSTR, DWORD, BOOL);
LIBSPEC BOOL PrintStrings (HANDLE, ...);
LIBSPEC BOOL PrintMsg(HANDLE, LPCTSTR);
LIBSPEC VOID ReportError (LPCTSTR, DWORD, BOOL);
LIBSPEC VOID ReportException (LPCTSTR, DWORD);
LIBSPEC DWORD Options (int, LPCTSTR *,LPCTSTR, ...);
LIBSPEC LPTSTR SkipArg (LPCTSTR);
LIBSPEC VOID GetArgs (LPCTSTR, int *, LPTSTR *);
// collection of generic string functions modeled after string.h
// created as required
LIBSPEC LPCTSTR whemchr (LPCTSTR, TCHAR, DWORD);
#ifdef _UNICODE //this declaration has to be added
#define _tstrrchr wcsrchr
#else
#define _tstrrchr strrchr
#endif
#ifdef _UNICODE //this declaration has to be added
#define _memtchr wmechr
#else
#define _memtchr memchr
#endif
//security functions
LPSECURITY_ATTRIBUTES InitializeUnicSA (DWORD, LPTSTR, LPTSTR, LPDWORD, LPHANDLE);
LPSECURITY_ATTRIBUTES InitializeAccessOnlySA (DWORD, LPTSTR, LPTSTR, LPWORD, LPHANDLE);
DWORD ReadFilePermissions (LPTSTR, LPTSTR, LPTSTR);
BOOL ChangeFilePermissions (DWORD, LPTSTR, LPTSTR, LPDWORD);
//constants needed by the security functions
#define LUSIZE 1024
#define ACCT_NAME_SIZE LUSIZE
//**************************************************************************************************
///* Envirmnt.h -- define UNICODE and _MT here
* It is best and easiest to define UNICODE within the project
* use Project...Settings...C/C++. Then, in the "Project Options"
* window on the bottom, add /D "UNICODE".
* Do the same for _MT and _STATIC_LIB.
*/
//#define UNICODE
#undef UNICODE
#ifdef UNICODE
#define _UNICODE
#endif
#ifdef UNICODE
#undef _UNICODE
#endif
//#define _STATICLIB
/* define _STATICLIB if you are either building a
* static library or linking with one*/
#define LANG_DFLT LANG_ENGLISH
#define SUBLANG_DFLT SUBLANG_ENGLISH_US</pre>
*****************************************************************************************
let me know what you can do with this as i have got into a right mess so far (as you can probably tell!!!
If i'm not dead enough for life, am i alive enough for death?
|
|
|
|
|
The following function takes in TreeNode *& root as one parameter given the fact that there is struct caled TreeNode.
TreeNode *root = NULL;
void treeInsert( TreeNode *& root, string newItem) {
if ( root == NULL ) {
root = new TreeNode(newItem);
return;
}
else if ( newItem < root->item ) {
treeInsert( root->left, newItem );
}
else {
treeInsert( root->right, newItem );
}
}
but, if I change the parameter to TreeNode & root, obviously this function loses value pointed by root pointer. Why is it this way? because when I have a function like below, even after existing the function, I still have head pointing to some value. (even without *& sign before head parameter)
Node * head = NULL;
void buildNode( Node * head, int valTemp)
{
if ( head == NULL)
{
Node * temp = new Node;
temp->next = NULL;
temp->val = valTemp;
head = temp;
}
else
{
Node *temp = head;
if( temp->next == NULL)
{
temp->next = new Node;
temp->next->val = valTemp;
temp->next->next = NULL;
}
else
{
while( temp->next!= NULL)
{
temp = temp->next;
}
temp->next = new Node;
temp->next->val = valTemp;
temp->next->next = NULL;
}
}
}
-- modified at 9:58 Saturday 22nd July, 2006
|
|
|
|
|
I want to change the bitmap of my toolbar button during runtime
i.e initially the bitmap is x on pressing it should change to y bitmap
how do i do that
please help me out
i am unable to find the right solution
Thanks in advance
|
|
|
|
|
|
I would like to test a library (dll) created with Visual C++. I have copied the .lib file to the project directory and created a button 'Test'.
How / do I use the extern function to be able to create objects of the classes created within the .lib file?
This example is not correct I know, but CSentenceAr is the Name of the class within the dll:
as in ... extern "C" _declspec(dllimport) CSentenceAr;
Is it possible to use the .dll file instead?
Jon
|
|
|
|
|
Do you have (header).h files associated with the .lib and .dll files?
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[ ]--
[My Current Status]
I dont know why the hell the script for voting 5 is disabled only for me??
|
|
|
|
|
If you wanna go by the .h + .lib way it's called implicit linking. Where you don't need to specify the location of the dll and call explicitly. You can call the functions as if their implementation is available in another file in you project.
You can use the DLL in another way. Explicit linking., where you will need these two
LoadLibrary^ This is to load the dll.\
GetProcAddress^This to locate a specific function inside the dll.
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[ ]--
[My Current Status]
I dont know why the hell the script for voting 5 is disabled only for me??
|
|
|
|
|
And in the end FreeLibrary
|
|
|
|
|
Hello,
We have an MFC application developed on Visual Studio .NET.
When we run it on PC's who have the VS installed, we have no problems. If, however, we attempt to run it on a PC without a Visual Studio installed on it, the application crashes as soon as we attempt to open a certain dialog.
The crash message indicates the error originates in the file occmgr.cpp, line 410 - an assert on the success of new COleControlSiteOrWnd.
I tried checking all OLE* dll's are present, as well as install .net framework 1.1 and 2.0, to no avail.
Any help would be greatly appreciated.
Eran.
|
|
|
|
|