|
There is no problem with style of that buttons, because they have simply put from the tool box.
I have commented the lines of code of that function and found the buttons is clicked properly. In that code it jump into other file and call DoModal of another dialog.
Is there any problem with this calling?
Thanks.
|
|
|
|
|
Hello folks!
This question isn't strictly C++/MFC related, but i do not know where to ask, so i ask you here. We have a few minidumps created when our software crashed at a betasite. The software is written in VC++/MFC (that's why i thought i ask here, maybe you experienced something like this too). When i try to open the minidumps in VS2003 i get the Blue Screen Of Death. First i thought this would be because 2003 is not supported on Win7. Now we acquired VS2010, but opening the crash dumps in VS2010 also gives me the sky-colored display of decease. Someone suggested that it might be because Home Premium doesn't support this function, but i highly doubt it, since if it was this case i'd expect to:
-see at least a warning about it when installing Visual Studio or trying to use dump-related things
-some nice window popping up telling me to rather buy the ultimate super-pro megaversion of windows which costs only 6 times the one i have now.
Googling for BSOD on crash dump analysis gives me loads of hits about how to analyse crash dumps created when Windows BSODs, none about why Windows might die if you try to analyse crash dumps.
(Hey, i could try analysing the crash dump of the BSOD, so i try to open it in VS...oups, BSOD, hey, i could try analysing the crash dump of this BSOD, so i try to open it in VS...oups, BSOD, hey, i could try analysing... just kidding)
Any of you heard/ran into anything like this before? Ah, another thing that might or might not be relevant, the dumps come from a 32 bit system while i am running on 64 bit. My colegue has Win7 Pro, also 64 bit, he has no trouble opening the dumps.
Thanks in advance for any suggestions, ideas, infoes, and sorry for the somewhat off-topic topic.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<
|
|
|
|
|
For crash dumps you need to use Windbg.exe to analyze them. You can get it straight off MSDN website.
Its an interesting debugger, very powerful, very very complex. But there is a help file which takes you through various debugging techniques as part of the install, read it and give it a go.
==============================
Nothing to say.
|
|
|
|
|
I'll give it a spin, thank you.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<
|
|
|
|
|
Hi all,
I want to write and read simulataneously from one process to another process using memory mapped.
I am able to write from one process and read from the other.
I am not able to read simultaneously.
Example: I have two process:
procees1 and process2
"Process 1 is writing",so if i run both exe,Process2 will read the message from process2.
Same way
I want to write in process2 simultaneously,so that i can read message from Process1 simulatenously
Here is the code i am using
Process1.cpp
#include "stdafx.h"
#include <windows.h>
#include <stdio.h>
#include <conio.h>
#include <tchar.h>
#define BUF_SIZE 2048
char buffer[BUF_SIZE];
TCHAR szName[]=TEXT("Global\\MyFileMappingObject");
TCHAR szName_read[]=TEXT("Global\\MyFileMappingObject1");
char *pSharedBuffer;
int addMsg(char *msg, char *buffer)
{
long msgCount, curMsgIndex, curMsgLen;
char *newStrPos;
memcpy(&msgCount, buffer, sizeof(long));
newStrPos = (char*) (long)buffer + sizeof(long);
for (curMsgIndex=0; curMsgIndex<msgCount; curMsgIndex++)
{
curMsgLen = strlen(newStrPos);
newStrPos += curMsgLen + 1;
}
strcpy(newStrPos, msg);
msgCount++;
memcpy(buffer, &msgCount, sizeof(long));
return 0;
}
int _tmain()
{
HANDLE handleMappedFile;
HANDLE handleMappedFile_read;
handleMappedFile = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, HIWORD(BUF_SIZE), LOWORD(BUF_SIZE), szName);
if (handleMappedFile == NULL)
{
printf("Could not create file mapping object.\n");
}
handleMappedFile_read = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, HIWORD(BUF_SIZE), LOWORD(BUF_SIZE), szName_read);
if (handleMappedFile_read == NULL)
{
printf("Could not create file mapping object1.\n");
return 1;
}
pSharedBuffer = (char*)MapViewOfFile(handleMappedFile, FILE_MAP_ALL_ACCESS, 0, 0, BUF_SIZE);
if (pSharedBuffer == NULL)
{
printf("Could not map view of file.\n");
CloseHandle(handleMappedFile);
return 1;
}
memset((PVOID)pSharedBuffer, 0, sizeof(char) * BUF_SIZE);
addMsg("Process 1 is writing", pSharedBuffer);
getch();
UnmapViewOfFile(pSharedBuffer);
CloseHandle(handleMappedFile);
return 0;
}
Process2.cpp
#include "stdafx.h"
#include <windows.h>
#include <stdio.h>
#include <conio.h>
#include <tchar.h>
#pragma comment(lib, "user32.lib")
#define BUF_SIZE 2048
TCHAR szName1[]=TEXT("Global\\MyFileMappingObject");
TCHAR szName_writing[]=TEXT("Global\\MyFileMappingObject1");
LPCTSTR pSharedBuffer;
int _tmain()
{
HANDLE hMappedFile;
hMappedFile = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, szName1);
if (hMappedFile == NULL)
{
printf("Could not open file mapping object (%d).\n",GetLastError());
}
HANDLE hMappedFile_Writing;
hMappedFile_Writing = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, szName_writing);
if (hMappedFile_Writing == NULL)
{
printf("Could not open file mapping object (%d).\n",GetLastError());
return 1;
}
pSharedBuffer =(LPTSTR)MapViewOfFile(hMappedFile, FILE_MAP_ALL_ACCESS, 0, 0, BUF_SIZE);
if (pSharedBuffer == NULL)
{
printf("Could not map view of file (%d).\n", GetLastError());
CloseHandle(hMappedFile);
return 1;
}
long msgCount, curMsgNum;
char *curMsg;
memcpy(&msgCount, pSharedBuffer, sizeof(long));
curMsg = (char*)pSharedBuffer + sizeof(long);
for (curMsgNum=0; curMsgNum<msgCount; curMsgNum++)
{
printf("%s\n", curMsg);
curMsg += strlen(curMsg) + 1;
}
UnmapViewOfFile(pSharedBuffer);
CloseHandle(hMappedFile);
getch();
return 0;
}
If anyone has any idea,please let me know
Thanks and Regards
Sharan
|
|
|
|
|
|
Hi,
Thanks for the information.I am able to write from process1 and read from process2.
But i want read and write simultaneously(even write from process2 and read from process1).
Ex:
1)Write some data from process1 and read the same data from process2.
same time
2)Write some other data from process2 and read the same data from process1.
Thanks
Sharan
|
|
|
|
|
Hello everybody,
i am having a combobox (created manually using resource tool) in a dialog box.
during runtime, i need to increase the width of the combobox window (not the drop down width). option is given for setting drop down width only. but i need to increase (or decrease) the width of the originally created combobox.
Is that possible?
i am using vs 2008 and win32 API.
Thanks in advance.
Regards
A. Gopinath.
Never mind. tried with MoveWindow(), its working fine.
Thanks again.
-- modified 26-Sep-11 7:38am.
|
|
|
|
|
Try with using CWnd::SetWindowPos[^] or CWnd::MoveWindow[^].
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<
modified 26-Sep-11 7:36am.
|
|
|
|
|
Hello,
Thanks for your reply.
Regards,
A. Gopinath
|
|
|
|
|
Hi,
I am currently writing a unicode MFC application in VS 8, and I want to get my commandline arguments. So I use ::__argv and ::__argc, but while the argument count is always determined correctly, ::__argvs always NULL in my Apps InitInstance-method.
Why? m_lpCmdLine however works, but I'd rather want to use __argv. Any hint why this parameter is always NULL?
|
|
|
|
|
|
did u try __targv, i am not sure. just give a try.
If u can Dream... U can do it
|
|
|
|
|
Generally speaking, installation or uninstall for LSP need a reboot. Is that possible not reboot after installation or uninstall in server edition windows, like 2003, 2008? If so, how could i do it, Any link or tip will be appreciated.
|
|
|
|
|
I'm missing something here. I can write a single value to a ads key, but I can't write a multistring value. I've been googling for hours, but can't really find anything on the subject
LPWSTR pszMimeMap[] = {
L".application, application/x-ms-application",
L".deploy, application/octet-stream",
L".deploy,application/octet-stream",
L".flv, video/x-flv",
L".manifest, application/-x-ms-manifest",
L".msp, application/octet-stream",
L".msu, application/octet-stream"};
dwNumber = sizeof(pszMimeMap)/sizeof(LPWSTR);
hr = ADsBuildVarArrayStr(pszMimeMap, dwNumber, &var);
hr = pADs->PutEx(ADS_PROPERTY_UPDATE, CComBSTR("MimeMap"), var);
VariantClear(&var);
I get the -214 something error in Hresult instead of the S_OK.
|
|
|
|
|
|
Good Call, I added the line, must of missed it.
Well after hours of testing, I can write the ScriptMaps, but not the MimeMap, I get some -214 error.
hr = pADs->PutEx(ADS_PROPERTY_UPDATE, CComBSTR("MimeMap"), var);
I can write this ScriptMaps key as a multi-string, and it works fine.
};
LPWSTR pszScriptMaps[] =
{
L".asp,C:\\WINDOWS\\system32\\inetsrv\\asp.dll,5,GET,HEAD,POST,TRACE",
L".cer,C:\\WINDOWS\\system32\\inetsrv\\asp.dll,5,GET,HEAD,POST,TRACE",
};
dwNumber = sizeof(pszScriptMaps)/sizeof(LPWSTR);
VariantInit(&var);
hr = ADsBuildVarArrayStr(pszScriptMaps, dwNumber, &var);
if (SUCCEEDED(hr)) {
hr = pADs->PutEx(ADS_PROPERTY_UPDATE, CComBSTR("ScriptMaps"), var);
}
VariantClear(&var);
modified 25-Sep-11 23:30pm.
|
|
|
|
|
Hello all,
I'm looking on the way that i could create my own namepsace and use it under C++.
i wrote a .h file
#ifndef FOO_H
#define FOO_H
namespace FOO
{
int add (int a , int b);
}
#endif//FOO_H
and a cxx file
#include "Foo.h"
namespace FOO
{
int add (int a , int b)
{
return (a+b);
}
}
And in the main prog (test.cxx) i did as shown below
#include <iostream>
#include "Foo.h"
using namespace FOO;
int main(int argc, char **argv)
{
std::cout << add(5, 6) << std::endl ;
return 0;
}
when i compile the prog it mentions no problems but when i try to execute it it said
undefined reference to `FOO::add(int, int)'
i look on the net but still having that issue.
how could i make it correct ?
thank you.
"The Ultimate Limit Is Only Your Imagination."
|
|
|
|
|
Ok i think that i resolved it by changing the .h file like this
#ifndef FOO_H
#define FOO_H
namespace Foo
{
int add (int a , int b)
{
return (a+b);
}
}
#endif//FOO_H
So that mean's that :
1: when using namespace we can only use header files.
or
2: i ve an error somewhere in my previous files.
could someone help me with that ? i get
"The Ultimate Limit Is Only Your Imagination."
|
|
|
|
|
What you did in your first post is correct.
The problem you run into is a LINKER problem, not compiler (if you are unsure about the difference, study a while how compile and linking process works)
Your "program" is actually made by two sources (main.cxx and foo.cxx): you have to compile them both, and link them together to produce a final executable. both the files must be inside your "project" configuration.
By placing the function definition in the header you solved the problem because now everything you need in known to main.cxx (that's probably the only file you compiled) But if you compile bot files now you will get a "symbol defined more than once" linked error.
So either:
- use separate files, but compile them all
- use only a single "cxx" and define everything the the header. But -in this second case- declare the functions you will define at header level as "inline" (inline int add(int a, int b) { ... } ) to avoid multiple definitions in case of multiple compilations.
2 bugs found.
> recompile ...
65534 bugs found.
|
|
|
|
|
You are all reasons,
I compiled the first post files with VS and in the project settings i included the Foo.cxx file and all worked fine.
I used Geany under ubuntu and in the console i wrote gcc test.cxx Foo.cxx -o Test.o
and then some warnings were releaved.
i think, as you said, i need to go backward and read more about linking files in C++
thank you for your help.
"The Ultimate Limit Is Only Your Imagination."
|
|
|
|
|
Blood_HaZaRd wrote: gcc test.cxx Foo.cxx -o Test.o
This is not correct, the output should be your executable file Test (note executables do not have .o extension). You should then be able to run your program by typing Test at the command prompt. Take a look at the man pages for gcc for more information on compile and link options.
|
|
|
|
|
I use method, AttachFile of class CMimeMessage to add a file to mail
CMimeMessage msg;
...
msg.AttachFile(_T("d:\1.txt"), _T("1.txt"));
then use CSMTPConnection::SendMessage(msg) to send this mail, but I find that this mail does not send to my mail box.
The mail account is no problem, because a blank mail can be sent.
I do not know how to use CMimeMessage to send a file ?
|
|
|
|
|
|
This is a C console application in VS2008.
I've got a script language similar to C but the host application has very few debug facilites. With a little modification I can convert the script to plain C and run it in a wrapper in a console app. In the script all variables must start $. If I try to watch a variable $x the watch window says:
$x CXX0017: Error: symbol "x" not found
If I #define $x x it finds it OK but I have to redefine all my variables this way in order to watch them.
Does anyone know why VS doesn't like the leading $ and whether it's possible to configure it to accept it as a normal symbol?
Thanks
A
|
|
|
|
|