|
Hi,
I would like to build an win32 application which sould not inherit from explorer.exe. By default all MFC/Win 32 applications are loaded in explorer.exe. so any crash of application is causing crash to explorer and vice versa..
So i need to find out a way where my application wont be loaded in explorer.
Thanks in advance.
Birajendu
SonicWALL India.
Bangalore.
India
|
|
|
|
|
birajendu wrote: win32 application which sould not inherit from explorer.exe
I will tell you a trick, try to figure out where your application is crashing and why.
Fix the bug.
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
Obviosly i will do that. But that is not the only solution. It would be nice if we can luch programs with out inheriting from explorer.exe. I saw some apllication from some trusted venders used to do so.. they dont load their application on explorer.
birajendu
CyberG India
Delhi
India
|
|
|
|
|
birajendu wrote: It would be nice if we can luch programs with out inheriting from explorer.exe
Well, that's the case. I have no clue about what you mean by "inheriting explorer"... If your application crashes, explorer doesn't crash. They are two independant things, so why would they interfere ? Unless maybe you are talking about something specific like a shell extension ?
|
|
|
|
|
yeah.. not exactly inheriting.. but all the applications in window by default load on explorer, some thing like child process of explorer. And my application is also doing the same. But i saw some applications like MacAfee client are independent.
birajendu
CyberG India
Delhi
India
|
|
|
|
|
birajendu wrote: But i saw...
Using?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi,
I want to create resizable propetysheet with watermark bitmap background.
Or a Header bitmap with colored background.
I am able to resize the proprtysheet but not header bitmap and background bitmap.
Please suggest some artical to do so.
|
|
|
|
|
CPropertySheet(
LPCTSTR pszCaption,
CWnd* pParentWnd,
UINT iSelectPage,
HBITMAP hbmWatermark,
HPALETTE hpalWatermark = NULL,
HBITMAP hbmHeader = NULL
);
See the parameters in bold. For setting the background you can override OnPaint message of your property sheet class
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
I have resource DLLs for my application. I'm loading DLL in my application. I want to get text associated with all the IDs.Longer way I know but that is quite hectic and not a good programming style.
I just want to know the shortcut code for that which uses some APIs and loads the text.
Can anyone help me?
Thanks.......
|
|
|
|
|
Which method are you using to get id's from the resource dll?
LoadLibrary???
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
|
Hi Purish,
Have you tried SetDlgItemText[^] & GetDlgItemText[^]?
Do not trust a computer...
Always check what computer is doing
regards,
Divyang Mithaiwala
Software Engineer
|
|
|
|
|
I am looking for the same.
Well how can I go there, I want to know the full code as I am new to it,so don't have much knowledge.
Something like AfxGetMainWnd-DlgCtrlId->
how can I do this?
Thanks..........
|
|
|
|
|
how to get those texts associated with IDs?
|
|
|
|
|
Purish Dwivedi wrote: Something like AfxGetMainWnd-DlgCtrlId->
If you are accessing Dialog item from DLL then DLL must have handle/pointer of CDialog class.
If you don't have then take one pointer of CDialog class & write one method in your DLL for setDialog(CDailog*)
So, at initialization of DLL you can specify CDialog pointer in that.
I hope this works for you.
Do not trust a computer...
Always check what computer is doing
regards,
Divyang Mithaiwala
Software Engineer
|
|
|
|
|
Are you referring to LoadString() ?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi i am using CEDB to access windows CE datas.. Now i need to update the datas in CEDB.
code:
oid=CeSeekDatabaseEx(globalHDB,CEDB_SEEK_BEGINNING,seekcount,NULL,NULL);
I use it to seek in database for each cases i uses
case 0:
epropColumn[0].propid = CID_BOOKID;
cepropColumn[0].val.lpwstr=szBookID;
cepropColumn[0].wFlags = NULL;
cepropColumn[0].wLenData = 0;
to get the column values i use these cases for each column of the row.
Can any one help me to change only one value in the row.
for example
if i hav book id,book_name,author.
say
bk001,C++,martin
i need it to be changed as
bk001,Java,martin
A code snippet would be help ful.
Help me to trace it out.
Thanks in Advance.
|
|
|
|
|
I am writing the simple copy files console.
And i am getting the error:
error C2664: 'CreateFileA' : cannot convert parameter 1 from 'std::basic_string<elem,_traits,_ax>' to 'LPCSTR'
#include <windows.h>
#include <iostream>
#include <string>
using namespace std;
const int BUF_SIZE = 1024;
int main(int argc, char *argv[])
{
HANDLE fileIn, fileOut;
char buf[BUF_SIZE];
DWORD nread,nwrote;
string folder1 = "C:\\firstFolder\\";
string folder2 = "C:\\secondFolder\\";
string folder[] = {folder1, folder2};
int count=0;
for (int i = 0; i < 2; i++)
{
// copy files
if ((fileIn = CreateFile("1.doc", GENERIC_READ,0, 0, OPEN_EXISTING, 0, 0)) == INVALID_HANDLE_VALUE) {
cerr << "Error opening source: " << GetLastError() << endl;
}
if ((fileOut = CreateFile(folder[i] + "new.doc", GENERIC_WRITE,0, 0, CREATE_NEW, 0, 0)) == INVALID_HANDLE_VALUE) {
cerr << "Error opening destination: " << GetLastError() << endl;
}
while (ReadFile(fileIn, buf, BUF_SIZE,&nread, NULL) && nread > 0) {
if ( ! WriteFile(fileOut, buf, nread,&nwrote, NULL)) {
cerr << "Error copy" << GetLastError() << endl;
}
}
CloseHandle(fileIn);
CloseHandle(fileOut);
// copy files
if ((fileIn = CreateFile("2.doc", GENERIC_READ,0, 0, OPEN_EXISTING, 0, 0)) == INVALID_HANDLE_VALUE) {
cerr << "Error opening source: " << GetLastError() << endl;
}
if ((fileOut = CreateFile(folder[i] + "new2.doc", GENERIC_WRITE,0, 0, CREATE_NEW, 0, 0)) == INVALID_HANDLE_VALUE) {
cerr << "Error opening destination: " << GetLastError() << endl;
}
while (ReadFile(fileIn, buf, BUF_SIZE,&nread, NULL) && nread > 0) {
if ( ! WriteFile(fileOut, buf, nread,&nwrote, NULL)) {
cerr << "Error copy" << GetLastError() << endl;
}
}
CloseHandle(fileIn);
CloseHandle(fileOut);
}
return 0;
}
Does any one know how to solve the error?
Pls show me a example code if possible, thanks.
|
|
|
|
|
you can do it like this
CreateFile(_T("1.doc"), GENERIC_READ,0, 0, OPEN_EXISTING, 0, 0)
|
|
|
|
|
This line of code doesn't has error,
CreateFile("1.doc", GENERIC_READ,0, 0, OPEN_EXISTING, 0, 0)
My error code is here,
fileOut = CreateFile(folder[i] + "new.doc", GENERIC_WRITE,0, 0, CREATE_NEW, 0, 0)
I cannot write the string into the parameter 1 with only allow 'LPCSTR', and i tried to convert it, but i getting another error:
CXX0052: Error: member function not present
string path;
path = folder[i] + "new.doc";
fileOut = CreateFile(path.c_str(),GENERIC_WRITE,0, 0, CREATE_NEW, 0, 0);
any idea? thanks..
|
|
|
|
|
// test01.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <windows.h>
#include <iostream>
#include <string>
using namespace std;
const int BUF_SIZE = 1024;
int main(int argc, char *argv[])
{
HANDLE fileIn, fileOut;
char buf[BUF_SIZE];
DWORD nread,nwrote;
wstring folder1 = L"C:\\firstFolder\\";
wstring folder2 = L"C:\\secondFolder\\";
wstring file1 =L"1.doc";
wstring file2=L"new.doc";
wstring file3=L"2.doc";
wstring file4=L"new2.doc";
wstring folder[] = {folder1, folder2};
int count=0;
for (int i = 0; i < 2; i++)
{
// copy files
if ((fileIn = CreateFile(file1.c_str(), GENERIC_READ,0, 0, OPEN_EXISTING, 0, 0)) == INVALID_HANDLE_VALUE) {
cerr << "Error opening source: " << GetLastError() << endl;
}
if ((fileOut = CreateFile((folder[i] + file2).c_str(), GENERIC_WRITE,0, 0, CREATE_NEW, 0, 0)) == INVALID_HANDLE_VALUE) {
cerr << "Error opening destination: " << GetLastError() << endl;
}
while (ReadFile(fileIn, buf, BUF_SIZE,&nread, NULL) && nread > 0) {
if ( ! WriteFile(fileOut, buf, nread,&nwrote, NULL)) {
cerr << "Error copy" << GetLastError() << endl;
}
}
CloseHandle(fileIn);
CloseHandle(fileOut);
// copy files
if ((fileIn = CreateFile(file3.c_str(), GENERIC_READ,0, 0, OPEN_EXISTING, 0, 0)) == INVALID_HANDLE_VALUE) {
cerr << "Error opening source: " << GetLastError() << endl;
}
if ((fileOut = CreateFile((folder[i] + file4).c_str(), GENERIC_WRITE,0, 0, CREATE_NEW, 0, 0)) == INVALID_HANDLE_VALUE) {
cerr << "Error opening destination: " << GetLastError() << endl;
}
while (ReadFile(fileIn, buf, BUF_SIZE,&nread, NULL) && nread > 0) {
if ( ! WriteFile(fileOut, buf, nread,&nwrote, NULL)) {
cerr << "Error copy" << GetLastError() << endl;
}
}
CloseHandle(fileIn);
CloseHandle(fileOut);
}
return 0;
}
|
|
|
|
|
You are misusing the string class. Read the docs
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
KarstenK wrote: You are misusing the string class. Read the docs
Ah, but string deserves it. It said bad things about his mother.
But I'm not a huge fan of string for this reason. I quite like CString's implicit LPCTSTR conversion.
Iain.
In the process of moving to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job!
|
|
|
|
|
Hi I have an assignment to write a simple phone book program. I've done that & everything is working perfectly except my edit function. Can someone plz help me. Here is what I've done so far (sorry it's so long):
/*
Name: Subrina's Phone Book
Author: Subrina Bisnauth
Description: Electronic phone book
*/
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <time.h>
void menu();
void program_start();
void add();
void edit();
void search();
void del();
void view();
void program_exit();
void DelayProg(float sec);
char name[100];
char email[50];
char phone[15];
char namebuff[50];
char lnamebuff[50];
char buf[80];
int count;
FILE *phonebook;
FILE *pbtemp;
time_t now;
struct tm *ts;
/*Main Function*/
int main()
{
system("CLS");
program_start();
menu ();
view();
return 0;
}
/*Menu Function*/
void menu()
{
int ch = 0;
char ch2;
program_start();
printf("\t\t Please choose one . . .\n\n");
printf("\t\t\t1: < Add to phonebook >\n");
printf("\t\t\t2: < Edit phonebook >\n");
printf("\t\t\t3: < Search phonebook >\n");
printf("\t\t\t4: < Remove from phonebook >\n");
printf("\t\t\t5: < View phonebook >\n");
printf("\t\t\t6: < Exit phonebook >\n\n");
printf("\t\t\t\tPlease enter the number of your choice: ");
fflush(stdin);
scanf("%d", &ch);
switch(ch)
{
case 1:
add();
case 2:
edit();
case 3:
search();
case 4:
del();
case 5:
view();
case 6:
program_exit();
default:
program_start();
printf("\t\tYou must choose 1 - 5. Retry? Y/N ");
fflush(stdin);
scanf("%c", &ch2);
if(ch2=='y'||ch2=='Y')
{
menu();
}
else
{
program_exit();
}
}
}
/*Function executed at program start-up*/
void program_start()
{
system("CLS");
FILE *file;
}
/* Function that allows new entries to be made in the phonebook*/
void add()
{
int numbers[100];
char choice;
do {
int Exists = 0;
program_start();
printf("\t\t- Add to Phonebook -\n\n");
printf("\n\t\t\tEnter Full Name: ");
fflush(stdin);
gets(name);
strcat(name, "|");
strcat(name, "\n");
phonebook = fopen("phonebook.txt","a+");
while(!feof(phonebook) && Exists==0)
{
fgets(namebuff, 50, phonebook);
if(strcmp(name, namebuff)==0)
{
printf("\n\t\tThat entry is already stored in the phonebook . . .");
printf("\n\n\t\t\t");
system("PAUSE");
Exists=1;
}
}
if(!Exists)
{
ts = localtime(&now);
strftime(buf, sizeof(buf), "%a %Y-%m-%d %H:%M:%S %Z", ts);
printf("\n\t\t\tEmail : ");
gets(email);
fflush(stdin);
printf("\n\n\t\t\tPhone Number: ");
gets(phone);
fflush(stdin);
fprintf(phonebook, "%s%s\n%s\n\n%s\n%s\n", name, email, phone, buf);
}
fclose(phonebook);
program_start();
printf("If you would like to continue press Y or if you want to return to the menu press N\n ");
fflush(stdin);
scanf("%c", &choice);
if(choice!='y'&&choice!='Y')
{
menu();
}
}while(choice=='y'||choice=='Y');
}
/*Function to search for a particular entry in the phonebook*/
void search()
{
char choice;
int length;
do {
int Exists = 0;
int i = 1;
program_start();
printf("\t\t- Search phonebook -\n\n");
printf("\n\t\t\tEnter Full Name: ");
fflush(stdin);
gets(name);
strcat(name, "|");
strcat(name, "\n");
phonebook = fopen("phonebook.txt","r");
while(!feof(phonebook) && Exists==0)
{
fgets(namebuff, 50, phonebook);
if((strcmp(namebuff, name)==0))
{
Exists = 1;
while(i<6)
{
if(i==1)
{
fgets(email, 50, phonebook);
fflush(stdin);
}
if(i==5)
{
fgets(phone, 15, phonebook);
fflush(stdin);
}
i++;
}
}
}
if(Exists)
{
name[strlen(name)-2]=' ';
printf("\n\t\tSuccess . . .\n\n");
printf("\t\tName : %s\n", name);
printf("\t\tEmail : %s\n", email);
printf("\t\tPhone Number: %s\n", phone);
printf("\n\n\t\t\t");
system("PAUSE");
fflush(stdin);
}
else
{
length = strlen(name);
name[length-2] = '\0';
printf("\n\t\tSorry . . .\n\n");
printf("\t\t\"%s\" was not found in phonebook.", name);
printf("\n\n\t\t\t");
system("PAUSE");
fflush(stdin);
}
fclose(phonebook);
program_start();
printf("If you would like to continue press Y or if you want to return to the menu press N\n ");
fflush(stdin);
scanf("%c", &choice);
if(choice!='y'&&choice!='Y')
{
menu();
}
}while(choice=='y'||choice=='Y');
}
/*Function to edit entries in the phonebook*/
void edit()
{
char choice;
int length;
do {
int Exists = 0;
int i = 1;
int g;
char ph[6];
char nam[25];
char e_mail[15];
char tel[15];
program_start();
printf("\t\t- Edit an entry -\n\n");
printf("\n\t\t\tEnter Full Name: ");
fflush(stdin);
gets(name);
strcat(name, "|");
strcat(name, "\n");
phonebook = fopen("phonebook.txt","r+");
while(!feof(phonebook) && Exists==0)
{
fgets(namebuff, 50, phonebook);
if((strcmp(namebuff, name)==0))
{
Exists = 1;
while(i<6)
{
if(i==1)
{
fgets(email, 50, phonebook);
fflush(stdin);
}
if(i==5)
{
fgets(phone, 15, phonebook);
fflush(stdin);
}
i++;
}
}
}
if(Exists)
{
name[strlen(name)-2]=' ';
for (g=0;g<count;g++)
{
printf("\n\tPlease enter what you would like to edit - name, e-mail or tel");
scanf("%s", &ph);
if(ph=='name')
{
printf("\n\t\tPlease enter the correct name");
scanf("%s",&nam);
name[g]=nam;
}
if(ph=='e-mail')
{
printf("\n\t\tPlease enter the correct e-mail address");
scanf("%s",&e_mail);
email[g]=e_mail;
}
if(ph=='tel')
{
printf("\n\t\tPlease enter the correct telephone #");
scanf("%s",&tel);
phone[g]=tel;
}
}
}
else
{
length = strlen(name);
name[length-2] = '\0';
printf("\n\t\tSorry . . .\n\n");
printf("\t\t\"%s\" was not found in phonebook.", name);
printf("\n\n\t\t\t");
system("PAUSE");
fflush(stdin);
}
fclose(phonebook);
program_start();
printf("If you would like to continue press Y or if you want to return to the menu press N\n ");
fflush(stdin);
scanf("%c", &choice);
if(choice!='y'&&choice!='Y')
{
menu();
}
}while(choice=='y'||choice=='Y');
}
/*Fuction to delete entries from phonebook*/
void del()
{
char conf;
int Exist = 0;
int len;
int i = 1;
program_start();
printf("\t\t- Delete From phonebook -\n\n");
printf("\n\t\t\tEnter Full Name: ");
fflush(stdin);
gets(name);
strcat(name, "\n");
if(phonebook = fopen("phonebook.txt", "r"))
{
printf("\n\n\t\tDelete the selection? Y/N ");
scanf("%c", &conf);
if(conf=='y'||conf=='Y')
{
if(pbtemp = fopen("phonebook", "w"))
{
while(!feof(phonebook))
{
fgets(namebuff, 50, phonebook);
len = strlen(namebuff);
if(namebuff[len-2]=='|')
{
namebuff[len-2]='\n';
namebuff[len-1]='\0';
if(strcmp(name, namebuff)!=0)
{
while(i<6)
{
if(i==1)
{
fgets(email, 50, phonebook);
fflush(stdin);
}
if(i==5)
{
fgets(phone, 15, phonebook);
fflush(stdin);
}
i++;
}
namebuff[len-2]='|';
namebuff[len-1]='\n';
fprintf(pbtemp, "%s%s%s", namebuff, email, phone);
}
else if((strcmp(name, namebuff)==0))
{
Exist = 1;
}
}
}
if(!Exist)
{
fclose(pbtemp);
fclose(phonebook);
len = strlen(name);
name[len-1]='\0';
program_start();
printf("\t\t- Delete From phonebook -\n\n");
printf("\t\tSorry . . .\n\n");
printf("\t\t\"%s\" was not found in phonebook.\n\n", name);
printf("\t\t\t");
system("PAUSE");
fflush(stdin);
remove("phonebook.txt");
menu();
}
}
else
{
fclose(phonebook);
fclose(pbtemp);
program_start();
printf("\t\t- Delete From phonebook -\n\n");
printf("\t\t\tError . . .\n\n");
printf("\t\t\tThe file could not be opened.\n\n");
printf("\t\t");
system("PAUSE");
fflush(stdin);
menu();
}
fclose(pbtemp);
fclose(phonebook);
len = strlen(name);
name[len-1]='\0';
remove("phonebook.txt");
rename("pbtemp.txt", "phonebook");
program_start();
printf("\t\t- Delete From phonebook -\n\n");
printf("\t\t\t\"%s\" was deleted from phonebook.", name);
printf("\n\n\t\t");
system("PAUSE");
fflush(stdin);
view();
}
else
{
fclose(phonebook);
len = strlen(name);
name[len-1]='\0';
program_start();
printf("\t\t- Delete From phonebook -\n\n");
printf("\t\t\t\"%s\" was not deleted.", name);
printf("\n\n\t\t");
system("PAUSE");
menu();
}
}
else
{
program_start();
printf("\t\t- Delete From phonebook -\n\n");
printf("\t\t\tError . . .\n\n");
printf("\t\t\tThe file could not be opened.\n\n");
printf("\t\t");
system("PAUSE");
menu();
}
}
/*Function that allows user to view entries in phonebook*/
void view()
{
namebuff[0] = '\0';
int len;
phonebook = fopen("phonebook.txt", "r");
program_start();
printf("\t\t- View phonebook -\n\n");
while(!feof(phonebook))
{
int i = 1;
fflush(stdin);
fgets(namebuff, 50, phonebook);
len = strlen(namebuff);
if(namebuff[len-2]=='|')
{
while(i<6)
{
if(i==1)
{
fgets(email, 50, phonebook);
fflush(stdin);
}
if(i==5)
{
fgets(phone, 15, phonebook);
fflush(stdin);
}
i++;
}
namebuff[len-2]=' ';
printf("\n\t\t\tName : %s", namebuff);
printf("\n\t\t\tEmail : %s", phone);
printf("\n\t\t\tPhone Number: %s\n", phone);
}
}
printf("\n\n\t\t\t");
system("PAUSE");
fclose(phonebook);
menu();
}
/*Function executed when program is about to close*/
void program_exit()
{
fflush(stdin);
program_start();
printf("\t\t\tThank you for using phonebook . . .");
DelayProg(2);
}
/*Function that controls the time delay when program is about to exit*/
void DelayProg(float sec)
{
float t = GetTickCount() + (1000L*sec);
while(GetTickCount() < t)
{
}
exit(1);
}
/*End of Program*/
|
|
|
|
|
Subrina Bisnauth wrote: (sorry it's so long):
So then fix it. If you already know the problem is with edit() , then post just that code. All the other is just useless noise.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|