|
In my application, I get excel' HINSTANCE,I want to get it's ProcessID,So I can right control that excel instance that I created.
|
|
|
|
|
Hi,
I am developping my own bluetooth application. I will comunicate through serial port profile with another device (no mobile phone, no PC) but specific bluetooth device. My application is written in Visual C++. On MSI support they written to me that I should use Widcomm bluetooth driver, but I can't find how to use this driver from my application.
Can help me somebody with this problem?
Marek
|
|
|
|
|
Hi all,
I'd like to get the selected extension, when I close file save dilaog. If I select any file, No problem. But If I enter a name, I need to have current exetension. How to get this?
Thanks in advance,
Sarvan AL
|
|
|
|
|
Does either of OPENFILENAME.nFileExtension or OPENFILENAME.lpstrDefExt help?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Ideally for a Save-As dlg output should know the ext type of the document to be saved.
what I feel is it is confusing to display a Save-As dialog with no default extension.
Take the eg of Winword. when you try to save the file, it provides finite set of extensions in the "Save-as TYpe" combobox.
Inshort User can either provide a file with ext or system should provide the ext type in the filter type parameter.
see eg of pdf file save-As dlg:
CString strFilter = _T("PDF Files (*.pdf)|*.pdf||");<br />
<br />
CFileDialog saveDlg(FALSE, _T("*.pdf"), "" , OFN_NOREADONLYRETURN | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, strFilter);<br />
if(IDOK == saveDlg.DoModal())<br />
{<br />
}<br />
|
|
|
|
|
Hi everybody!
I have some experience with C++ and Borland Builder, but I`m totally new to Visual C++. Im using Visual C++ 6.0.
I need to load an image into my program, this picture inside a rectangle. This pic will be a .jpg. I need to have the option to put the picture anywhere inside this rectangle, in any time. Then I have to send it to printer, but JUST THE RECTANGLE AREA, not the whole thing that`s displaying in my program frame. The printer should be able to print using the rectangle as if it was the page size.
I just need some help!
- what component should I use to display the pic, one that has the above characteristics?
- Am I able to put this component into a common dialog frame and still be able to select just a rectangle area from this dialog to send to printer? What are the stepes to do that or where can I find the right info about that? Or should I use a Document page from a Single Document MFC Project? In this case, how would I be able to put the pic inside it?
- Finally, how can I send this rectangle to print so the printing process act the way described above?
Im stucked with this problem for a few days now and I just cant find info... Thank you all!
Cassio Marques
|
|
|
|
|
Dear all,
I'm writing a small application that manages the Themes service using WMI.
Unfortunately I have problems with the parameters. The API documentation says that it is a string, but I wasn't able to find a solution.
ExecMethod returns : WBEM_E_INVALID_METHOD_PARAMETERS = 0x8004102f
I have realized that the parameter is not well formatted, but I'm not able to find any tip.
Notice that the same code querying for "Win32_Process" and calling "Create" using CommandLine as parameter and "notepad.exe" as value, runs correctly. To test it, it is enough to replace the strings text.
Thanks
Daniele
// some WMI initialization here.....
IWbemClassObject *pClass = NULL;
IWbemClassObject *pInParams = NULL;
IWbemClassObject *pInParamInstance = NULL;
IWbemClassObject *pOutParams = NULL;
IEnumWbemClassObject *pEnumerator = NULL;
IWbemClassObject *pInstance = NULL;
DWORD dwCount = 0;
HRESULT hres;
BSTR bstrChangeStartMode = L"ChangeStartMode";
BSTR bstrClassName = L"Win32_Service";
BSTR bstrParamName = L"StartMode";
BSTR bstrParamValue = L"Automatic";
VARIANT varValue;
VARIANT varReturnValue;
// query for the proper object to which apply the method
hres = pSvc->ExecQuery( bstr_t("WQL"),
bstr_t("SELECT * FROM Win32_Service Where Name = 'Themes'"),
WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY,
NULL,
&pEnumerator);
while (pEnumerator->Next( WBEM_INFINITE, 1,&pInstance, &dwCount) == WBEM_S_NO_ERROR)
{
// get method class
hres = pSvc->GetObject( bstrClassName, 0, NULL, &pClass, NULL);
// prepare method params
if (pClass)
hres = pClass->GetMethod(bstrChangeStartMode,0,&pInParams,NULL);
else
{
printf("Unable to get method '%s' from '%s' class\n", CString(bstrChangeStartMode), CString(bstrClassName));
return -1;
}
if (pInParams)
hres = pInParams->SpawnInstance(0, &pInParamInstance);
else
{
printf("Unable to get params for from %s::%s()\n",
CString(bstrClassName),
CString(bstrChangeStartMode));
return -2;
}
// analyzing the method paramenter (debug purposes only)
printf("Analyzing the %s::%s() paramenter(s)...\n",
CString(bstrClassName),
CString(bstrChangeStartMode));
hres = pInParams->BeginEnumeration(0);
BSTR pName = NULL;
while ((pInParams->Next(NULL, &pName, NULL, NULL, NULL)) == BEM_S_NO_ERROR)
{
CString s(pName);
printf("Property value: %s\n", s);
}
pInParams->EndEnumeration();
printf("\n");
// Create the values for the in-parameters
VariantInit(&varValue);
varValue.vt = VT_BSTR;
varValue.bstrVal = bstrParamValue;
// assign a value to the option...
if (pInParamInstance)
hres = pInParamInstance->Put( bstrParamName, 0,
&varValue,
0);
else
{
printf("Unable to create params instance for %s::%s()\n",
CString(bstrClassName),
CString(bstrChangeStartMode));
return -3;
}
if (hres != S_OK)
return -4;
// Execute Method
hres = pSvc->ExecMethod(bstrClassName, // class
bstrChangeStartMode, // method
0, // synchronous call NULL, //
pInParamInstance, // input
&pOutParams, // output
NULL);
if (hres != S_OK)
break;
} // end while pEnumerator
if (pEnumerator)
pEnumerator->Release();
} // end query....
if (hres != S_OK)
{
printf("Exec method for %s::%s() returned 0x%08X\n\n",
CString(bstrClassName),
CString(bstrChangeStartMode),
hres);
}
Daniele
|
|
|
|
|
Hi
I have a question,I write this question yesterday but I think that I couldn't that what I need?
see if one page has many links for download we can click in links and download it link
(with classes Chttp,CInternetSession,CHttpConnection,.... or with URLDownloadToFile)
Now if I have to enumerate this links how to do? almost like ftp that enumerate files or directories
Is it possible?
Thanks
|
|
|
|
|
messages wrote: Now if I have to enumerate this links how to do?
Enumerate links? What do you mean by this?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Instead click in each link I want to read this links and then download they see example:
In one page 10 links to pictures,pictures are thubmnail and if we click in this thubm then we can see full picture
but I want without click directly read this files
Is it possible?
Thanks
|
|
|
|
|
messages wrote: Is it possible?
Most likely. Load the HTML page using the IHTMLDocument2 interface, and then iterate each of the Anchor <A> elements. Search for IHTMLElementCollection. Here is another example.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
|
|
Hi Mila025
thank you for link but is there any way to enumerate links
I think that is't not possible.
Thanks
|
|
|
|
|
Hi
One of my friends is getting a strange problem with his code in c++. He has stored some integer values in an array. That array is declared in a class as its member variable.
In a function before printing this array using cout, he wrote the following statement.
cout<<"DAY\tBreak up\tBuying Price\tSelling Price\tGain/Loss\n";
We saw it in Debugger mode that when above statement executes, all values in that array are changed and some garbage values are displayed.
Please can you tell me why this is happening?
Thank you.
We Believe in Excellence
www.aqueelmirza.cjb.net
|
|
|
|
|
|
Thank you for your responce. Here is the code
cout<<"DAY\tBreak up\tBuying Price\tSelling Price\tGain/Loss"<<endl;<br />
for(;curr->next!=&head;curr=curr->next)<br />
{<br />
for(;curr->next->array[i].day_number!=-1;i++)<br />
{<br />
cout<<curr->next->array[i].day_number<<"\t"<br />
<<curr->next->array[i].break_up<<"\t"<br />
<<curr->next->array[i].buying_price<<"\t"<br />
<<curr->next->array[i].selling_price<<"\t"<br />
<<curr->next->array[i].capital_gain<<endl;<br />
}<br />
}
I tried this code after omitting the first cout line. but in inner for loop before printing the values again it changes the array contents.
How it is possible?
We Believe in Excellence
www.aqueelmirza.cjb.net
|
|
|
|
|
Aqueel wrote: cout<<"DAY\tBreak up\tBuying Price\tSelling Price\tGain/Loss\n";
Use endl instead of \n .
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
problem still remains the same
in this block of code if i perform a very very simple output operation (cout<<"Hello"<
|
|
|
|
|
Here is the whole code u can copy past into your browser and run it
Note
file inpu.txt has the following format
B 100 20
B 20 24
B 200 36
S 150 30
//code begins from here
#include<iostream.h>
#include<fstream.h>
//*******************************************************************
struct SDATA
{
int day_number;
int break_up;
int buying_price;
int selling_price;
int capital_gain;
};
//*******************************************************************
class QNode
{
friend class Queue;
private:
QNode* next;
int day;
int shares;
int price;
QNode(){next=NULL;}
};
//*******************************************************************
class LLNode
{
friend class LList;
friend class Queue;
friend void main();
private:
LLNode* prev;
LLNode* next;
SDATA array[10];
LLNode()
{
prev=NULL;
next=NULL;
for(int i=0;i<10;i++)
{
array[i].day_number=-1;
array[i].break_up=-1;
array[i].buying_price=-1;
array[i].selling_price=-1;
array[i].capital_gain=-1;
}
}
};
//*******************************************************************
class Queue
{
private:
QNode* front;
QNode* rear;
public:
Queue(){front=rear=NULL;};
bool Enqueue(ifstream&);
bool Dqueue(LLNode*, int, int&);
void dis();
};
//*******************************************************************
class LList
{
friend void main();
private:
LLNode head;
public:
LList()
{
head.next=&head;
head.prev=&head;
};
bool add(ifstream&, Queue);
void Display();
};
int dy=1;
//*******************************************************************
//*******************************************************************
bool Queue::Enqueue(ifstream& fin)
{
int shs;
int pr;
fin>>shs;
fin>>pr;
fin.get();
QNode* temp=new QNode();
temp->day=dy;
temp->price=pr;
temp->shares=shs;
if(front==NULL)
{
front=temp;
rear=temp;
rear->next=NULL;
return true;
}
else
{
rear->next=temp;
rear=rear->next;
rear->next=NULL;
return true;
}
delete temp;
}
//*******************************************************************
void Queue::dis()
{
QNode* curr;
curr=front;
int dy,pr,sh;
for(;curr!=NULL;curr=curr->next)
{
dy=curr->day;
pr=curr->price;
sh=curr->shares;
cout<<dy<<" "<<pr<<"="" "<<sh<<endl;
="" }
="" cout<<endl;
}
="" ********************************************************************
bool="" llist::add(ifstream&="" fin,="" queue="" q)
{
="" int="" sell_shares;
="" sell_price;
="" tot="0;
" llnode="" temp;
="" fin="">>sell_shares;
fin>>sell_price;
fin.get();
q.Dqueue(&temp,sell_shares,tot);
for(;tot>=0;tot--)
{
temp.array[tot].selling_price=sell_price;
temp.array[tot].capital_gain=(temp.array[tot].break_up*(sell_price-temp.array[tot].buying_price));
//******************
/*mret->array[tot].day_number=temp.array[tot].day_number;
mret->array[tot].buying_price=temp.array[tot].buying_price;
mret->array[tot].selling_price=temp.array[tot].selling_price;
mret->array[tot].break_up=temp.array[tot].break_up;
mret->array[tot].capital_gain=temp.array[tot].capital_gain;*/
}
LLNode* curr;
curr=&head;
while(curr->next!=&head)
curr=curr->next;
temp.next=curr;
temp.prev=curr->prev;
curr->prev->next=&temp;
curr->prev=&temp;
//************************************************************
{
curr=&head;
cout<<"DAY\tBreak up\tBuying Price\tSelling Price\tGain/Loss\n";
for(;curr->next!=&head;curr=curr->next)
{
for(int i=0;temp.array[i].day_number!=-1;i++)
{
cout<<temp.array[i].day_number<<"\t"
<<temp.array[i].break_up<<"\t"
="" <<temp.array[i].buying_price<<"\t"
="" <<temp.array[i].selling_price<<"\t"
="" <<temp.array[i].capital_gain<<endl;
="" }
=""
="" return="" false;
}
="" ********************************************************************
bool="" queue::dqueue(llnode*="" temp,int="" sell_shares,="" int&="" ret)
{
="" int="" sum="0;
" qnode*="" curr;
="" curr="front;
" count="sell_shares;
" for(int="" i="0;i<10&&curr!=NULL;i++)
" {
="">shares;
curr=curr->next;
}
curr=front;
if(sell_shares>sum)
{
cout<<"\nYOU ARE TRYING TO SELL SHARES OF MORE"<<endl;
cout<<"than="" last="" 10="" days..."<<endl;
="" return="" false;
="" }
="" else
="" {
=""
="" if(front="=NULL)" for(ret="0;count">0;ret++)
{
if(count<front->shares)
{
temp->array[ret].day_number=front->day;
temp->array[ret].buying_price=front->price;
temp->array[ret].break_up=count;
front->shares=front->shares-count;
count=0;
}
else if(sell_shares>=front->shares)
{
temp->array[ret].day_number=front->day;
temp->array[ret].buying_price=front->price;
temp->array[ret].break_up=front->shares;
count=count-front->shares;
front=front->next;
delete curr;
curr=front;
}
}
ret--;
return true;
}
}
}
//********************************************************************
void LList::Display()
{
LLNode* curr;
curr=&head;
int i=0;
cout<<"DAY\tBreak up\tBuying Price\tSelling Price\tGain/Loss"<<endl;
for(;curr-="">next!=&head;curr=curr->next)
{
for(;curr->next->array[i].day_number!=-1;i++)
{
cout<<curr->next->array[i].day_number<<"\t"
<<curr->next->array[i].buying_price<<"\t"
<<curr->next->array[i].break_up<<"\t"
<<curr->next->array[i].selling_price<<"\t"
<<curr->next->array[i].capital_gain<<endl;
}
=""
}
="" ********************************************************************
void="" main()
{
="" llnode="" temp;
="" queue="" q;
="" llist="" l;
="" char="" op;
="" ifstream="" fin;
="" fin.open("input.txt",ios::in);
="" fin="">>op;
while(!(fin.eof()))
{
if(op=='B')
{
for(;op=='B'&&(!fin.eof());)
{
Q.Enqueue(fin);
fin>>op;
dy++;
}
}
else if(op=='S')
{
for(;op=='S'&&(!fin.eof());)
{
L.add(fin,Q);
dy++;
fin>>op;
}
}
}
//Q.dis();
L.Display();
}
We Believe in Excellence
www.aqueelmirza.cjb.net
|
|
|
|
|
Strange. It should not happen this way.
Problem might lie before the cout statement.
As you said even if you write cout<<"Hello" it overwrites the array.
I would suggest to do a stepwise debug.
1) comment out all the array allocation and file reading part.
2) just main() -> and cout<<"Hello"
3) check if this works.
4) if it does then uncomment file readin part.
5) if tht works then problem lies somewhere in the array allocation part.
Hope this helps.
|
|
|
|
|
Hi all,
In my MDI application, I have 10 tool bars. I have a menu to select them. If it is visible, its menu item would be checked. I need to save the position of those tool bars when I exit the application. Next time I should be able to get toolbars, only which were selected earlier. Hope it's like persistent window concept. But I don't know how to make it possible for Toolbars.
If anybody could suggest me a path, it would be greatly appreciated.
Thanks in advance,
Sarvan AL
|
|
|
|
|
#ifdef EXPCLASS_EXPORTS
#define EXPCLASS_API __declspec(dllexport)
#else
#define EXPCLASS_API __declspec(dllimport)
#endif
// This class is exported from the EXPCLASS.dll
class EXPCLASS_API CEXPCLASS {
public:
CEXPCLASS(void);
char * CEXPMethod(char * plaintext , char * key);
// TODO: add your methods here.
};
How do i dynamically acces method export in CLASS?
CODE USED TO ACCESS METHOD EXPORT IN CLASS
hDLL = LoadLibrary("EXPCLASS.dll");
if (hDLL != NULL)
{
lpfnDllFunc1 = (LPFNDLLFUNC1)GetProcAddress(hDLL,"CEXPMethod");
if (lpfnDllFunc1 ==NULL)
{
// handle the error
FreeLibrary(hDLL);
}
else
{
strResult = lpfnDllFunc1("killer" ,"strikes HERE");
}
}
for thendral
-- modified at 6:54 Thursday 20th April, 2006
|
|
|
|
|
|
Hi naveen !
can u advise what exactly i need to do ?
Use this API to get the address of a function that returns an instance of the class that you wish to access dynamically.
For eg:
The function will be something like this...
void* FUNC_EXPORT CreateInstance()
{ return static_cast< void*> (new SomeClass);
}
Use GetProcAddress to get the address of this function
for thendral
|
|
|
|
|