|
Sorry;
When i clicked File->New (Ctrl+N).
My CArray m_PointList is in the document file (DocumentDoc.h).
For every new view, same doc file using, right? Same m_PointList?
But something wrong and i can't find it.
|
|
|
|
|
its not about using same document.h file.
everytime new instance of CDocuemnt will be created when you do ctrl+N
so every time m_PointList will have default values.
Regards,
Sandip.
|
|
|
|
|
What?
If so,
But why do we call updateallviews? Isn't that for all the views that created with Ctr+N?
Isn't that advantage of Doc/View architecture, One Document and multiple views?
I am really surprised.
|
|
|
|
|
Listen UpdateAllView is for updating All views associated with one instance of document. (not the views associated with different instances of documents.)
Consider TreeView1 ListView1 both are associated to docuemnt1.
Now when you call UpdateAllViews for docuement1 then Treeview1 and listview1 will be updated.
Regards,
Sandip.
|
|
|
|
|
I agree with Sandi, you are creating new documents, so you will have new pairs Doc-View and the new ones have nothing to do with the old ones.
If you DO want to have only one document and more views... take a look here[^]
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Hi everyone, I've been trying to make a simple password generator such that when i enter a number and click generate, a random string of
alphanumeric characters is generated. my problem is every time i click generate, only 1 letter seems to appear. Any help will be greatly appreciated. Source code is as follows:
#include <windows.h>
#include <iostream>
#include <string.h>
#include <cstdlib>
#include <ctime>
#include "resource.h"
BOOL CALLBACK DlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
switch(Message)
{
case WM_INITDIALOG:
SetDlgItemInt(hwnd, ID_PASSWORD,1, FALSE);
case WM_COMMAND:
switch(wParam)
{
case ID_GENERATE:
{
char alpha[80]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
char passwrd[80]="";
int numChars = GetWindowTextLength(GetDlgItem(hwnd, ID_PASSWORD));
if(numChars > 0)
{
// Now we allocate, and get the string into our buffer
srand(static_cast<unsigned>(time(0)));
for (int n=0; n<numchars; n++)<br="" mode="hold"> {
int x;
x = 0 + int(61.0 * rand()/(RAND_MAX+1.0));
passwrd[n]= alpha[x];
}
This is the main problem -----------------> MessageBox(NULL, passwrd, "Word Generated", MB_OK);
int index = SendDlgItemMessage(hwnd, IDC_LIST, LB_ADDSTRING, 0, (LPARAM)passwrd);
GlobalFree((HANDLE)passwrd);
}
else
{
MessageBox(hwnd, "You didn't enter anything!", "Warning", MB_OK);
}
}
}
break;
case WM_CLOSE:
EndDialog(hwnd, 0);
break;
default:
return FALSE;
}
return TRUE;
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
return DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG), NULL, DlgProc);
}
|
|
|
|
|
Please surround code snippets with <pre> tags.
also escape < when appropriate (you may use < for the purpose).
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
|
|
|
|
|
your character generation routine seems strange. Try something simple like:
for (int n=0; n < <code>PWLengthLessThan62</code>; n++ )
{
passwrd[n] = alpha[ rand() % 62 ];
}
passwrd[ 80 ] = '\0'; Might want to expand the characters used in your random password. Sticking to alnums is not too secure, IMHO.
You also have a character buffer for the password, so there is no reason to be messing around with any global memory routines.
Peace!
-=- James Please rate this message - let me know if I helped or not!<hr></hr> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
Thanks for the help. Managed to get it work
|
|
|
|
|
I am facing a strange problem to debug. My Program runs as a service and uses a static API library to make some function calls.
The API library dynamically loads X_SERV.DLL ( a WIN32DLL through LoadLibrary and GetProcAddres sequence).
This X_SERV.DLL loads Y_PH.DLL dnamically ( again through Load Library & GetProcAddress sequence ).
Y_PH.dll uses functions exported by Z_LH.dll ( through implict linking). Z_LH.dll uses MFC
Now when I shutdown my service, I get the following access violation error in mfc40u.dll ( Yes I have to use archaic VC4 )
---- The instruction at "0x61e6eff4" referenced memory at "0x00000004". The memory could not be "read" ------
The 0x61e6eff refers to an instruction in mfc40u.dll
The problem is strange because when I use DLLS A_PH.DLL in place of Y_PH.dll and B_LH.dll in place of Z_LH.dll, i never encounter this problem. The difference is A_PH.dll uses functions of B_LH.dll through explicit linking ( using LoadLibrary & GetProcAddress).Also B_LH.dll is a win32 dll.
Any insights on this is highly appreciated!!!
I am fairly new to these things in DLL ( MFC and implicit linking).. so if any of you wants more information that would give a clue, I would be more than happy to oblige.
Thanks in advance for your help...
Quality is never an accident. It is always the result of intelligent effort.
|
|
|
|
|
Hard to tell without knowing more. It's just guessing, but I would look at the following things:
1) Perhaps something is released too early while shutting down, causing this problem in a later step. A look at the sequence in which objects are released and functions are called may help.
2) Examine the parameters of the functions that do the shutting down and cleaning up. Perhaps one of them can't handle an invalid parameter, a NULL pointer for example. Use the debugger and examine the passed parameters, especially at the function call which results in the error.
A while ago he asked me what he should have printed on my business cards. I said 'Wizard'.
I read books which nobody else understand. Then I do something which nobody understands. After that the computer does something which nobody understands. When asked, I say things about the results which nobody understand. But everybody expects miracles from me on a regular basis. Looks to me like the classical definition of a wizard.
|
|
|
|
|
Hi CDP1802 and SandipG,
Thanks very much for your comments.
In the last DLL - Z_LH.dll, there is no DllMain function ( it is implicitly linked),
All other DLL's - X_SERV.dll & Y_PH.dll has DllMain function. X_SERV.dll do a FreeLibrary on Y_PH.dll as well during a DLL_PROCESS_DETACH.
As I said, this problem occurs only with Y_PH.dll & Z_LH.dll. Z_LH.dll
Here is the stack trace I got when I ran ADplus in crash mode on my application( My service application - myserviceapp.exe needs to run on a separate server different from where I can build it)
WARNING: Stack unwind information not available. Following frames may be wrong.
00 0012fd40 0a1789e3 0a170000 00000000 00000001 MFC40u!Ordinal1100+0x4f
01 0012fd60 7c82257a 0a170000 00000000 00000001 Z_LH!SetPort+0x16a3 (FPO: [Uses EBP] [3,0,4])
02 0012fd80 7c8118b0 0a178970 0a170000 00000000 ntdll!LdrInitializeThunk+0x24
03 0012fe1c 77e52fea 00000000 00000001 7ffde000 ntdll!RtlEnumerateGenericTableWithoutSplaying+0x9b
04 0012ff08 77e5304d 00000000 77e8f3b0 ffffffff kernel32!GetEnvironmentVariableA+0x3c4
05 0012ff1c 77bcade4 00000000 0012ff58 77bcaefc kernel32!ExitProcess+0x14
06 0012ff28 77bcaefc 00000000 00000000 00000000 msvcrt!strerror+0x2b4a
07 0012ff58 77bcaf52 00000000 00000000 00000000 msvcrt!initterm+0xf6
08 0012ff6c 00462ce6 00000000 00000000 00000000 msvcrt!exit+0x11
09 0012ffc0 77e523cd 00000000 00000000 7ffde000 myserviceapp+0x62ce6
0a 0012fff0 00000000 00462be0 00000000 78746341 kernel32!IsProcessorFeaturePresent+0x9e
Will this be of any help?. Couldnt decode it much
SetPort function is exported by Z_LH.dll and is never used at all in Y_PH.dll!! ( which impicitly links to Z_LH.dll)
Also in the logs, I can see informatio about so many "1st chance DLL_UnLoad exception" on the different DLL's starting from X_SERV.dll and many other dependant dlls including Y_PH.dll and Z_LH.dll
Please tell me if you need further information. I am looking at all ways to understand and solve this!!...
Quality is never an accident. It is always the result of intelligent effort.
|
|
|
|
|
When you receive STOP command in handler function of service try to stop all the work and unload all the dlls using FreeLibrary ().
Regards,
Sandip.
|
|
|
|
|
Hello,
I have made a dll.In the .h file I have written AFX_EXT_CLASS macro to export the class.
Which macro should I write for a file which has only consts defined and no class.
Regards,
Pritha
|
|
|
|
|
Hello,
This is another question.
It happens that even if I have the .lib and .dll files in the required directory but still when I execute it says the dll not found .
What must the reason ?
Pritha
|
|
|
|
|
prithaa wrote: It happens that even if I have the .lib and .dll files in the required directory but still when I execute it says the dll not found .
What must the reason ?
The DLL is not in the required directory, otherwise it would be found. Where you think is the required directory is obviously not where Windows is looking for it.
This article[^] tells you what the directories that Windows will search to find the DLL. Unless you are explicitly loading the DLL (using LoadLibary) or setting the DLL path in the manifest file then the DLL must be in one of these directories.
If you are putting the DLL in the same directory as the application (a common way of doing it which is the reason that Windows searches for it there first), then are you starting the application from there? If you are debugging from the IDE then check your project configuration properties. In the debugging tab set the working directory to $(TargetDir).
The other reason that I can think of is that you have set the path to the lib file in your application properties (the Linker additional libraries directory). This only sets the path for the linker, not for when you are running the application
Graham
Librarians rule, Ook!
|
|
|
|
|
Hi friends,
I am facing the problem while receving the new messages from another cell.my new message is in modem but i am not getting how read and what AT commands should used to the indication from the modem.
And i want to count the number of messages present in the sim.please tell me how can i solve this problem.please.Please Help me Soon.Give me some hints.
Thanks in Advance,
savitri
|
|
|
|
|
What the hell are you talking about ?
|
|
|
|
|
That's a Liquid Nitrogen[^] candidate.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
What ur telling.. ya I'm facing the problem while receving new msg from the modem.Please if u know the solution please tell me.i'm very thankful to u.Y ur scolding me.What i am getting problem i'm telling that only ok..
Thanku,
savitri
|
|
|
|
|
You need to put a bit more effort when writing your messages. I don't understand what you are saying.
And please avoid the sms speak, we are on a forum, not a chat for kids...
|
|
|
|
|
Hey Savitri,
He's not scolding you. You need to keep a few points in your mind, while asking a query in general.
For once, you need to avoid using SMS in this board. If you don't understand that, use "You" instead of "U" and "Why" instead of "Y", "Your" instead of "Ur", etc., This is not a very difficult thing to do.
Next to that, what is the message and what is the modem that you are talking about? What exactly is your problem? You need to specify it precisely, providing relevant source code, if required. You are assuming everyone else on the forum to know details about your project, which will never be the real case.
Plus, you need not mention that someone should solve your problem as soon as possible. People from all timezones visit this forum and some of them may be sleeping when you are asking them to do it ASAP. And they are not being paid to do what they are doing. In fact, most of the ones answering queries are stealing time from their employers, only in the good spirit of helping other developers to solve their problems.
Please read the sticky post at the top of this page, which says "How to get an answer to your question". Try and understand each of the points, keep those points in your mind while making a query in the future. Offending the guidelines will make you look arrogant and doing it repeatedly will get people to ignore you quickly.
I hope that you understood it and make better posts in the future. Well, I can only hope.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
the probability of you getting the answer would be more if you ask it in the Mobile Development Forum[^] .
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
AT Commands are universal but sometimes they also depend on the mobile manufacturer.
Just google a bit you will find the various AT Commands list.
BTW which modem are you using??
You cant just receieve new SMS with one command.
I had worked with LG Mobile where i had to set 2-3 commands and then the incoming message will be automatially forwarded to PC on com port.
Also if at all you are going to be NOKIA specific you can even think of FBUS protocol supported by all nokia mobiles.
Regards,
Sandip.
modified on Monday, June 2, 2008 7:04 AM
|
|
|
|
|