|
Layout->Tab Order
the Layout menu appears only when you are in the dialog editor.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
See here [^].
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
[My articles]
|
|
|
|
|
Hi All
I have one dll(created in c) and i have one console application(in C).Now i want to read console application variable value from dll.Is it possible please gimme ur input.
Mohan t C
|
|
|
|
|
Is the console application loading the dll ? If yes, why don't you simply export a function from the dll that returns the value ?
|
|
|
|
|
No,Dll calling console app variable value..
Mohan t working for N.I.C
|
|
|
|
|
Errr, what
I was asking if the dll was loaded by your console application (meaning that your console app uses the dll).
So, you are saying that your dll should use a variable from your application ? You can do the same as my previous suggestion: expose a function that is called by your app and which will set the value of the variable in the dll.
|
|
|
|
|
I understand,But how do we export console app function and how do we call it from dll.
I tried _declspec (dllexport),but am unable to do.
Thanks for ur help.
Mohan
|
|
|
|
|
Why would you want to do something like that ? This is really not a good practice. You have to keep in mind that your dll could be used not only by your application but by any other app. So, why don't you simply export a function in your dll that the application can call. By calling this function, your application can pass the value of the variable to your dll.
Anyway, what you are trying seems very strange and it seems you are a bit confused about the dll stuff. Can you explain what you are trying to achieve exactly ? Why do you need to retrieve this variable from your dll ? Maybe we'll be able to suggest a better approach.
Please bear in mind that we can't read your screen and we don't know anything about your application.
|
|
|
|
|
Thanks and sorry for this confusion.
Actually i want to get user input(runtime) say username and password.i couldn't do that in DLL.so i planned to use console application for getting user inputs and stored in some variable.then i will get that variable values calling from dll.
Mohan t
|
|
|
|
|
So, what prevents you to retrieve to credentials in your console application and pass them to your dll by calling an exported function of your dll (for instance checkCredentials(std:string username, std:string password) ) ?
Why do you absolutely wants your dll calling your application ?
|
|
|
|
|
Am running a tool using my Dll.Previously we were hardcoded username and password(passing parameter) now i dont want to hardcode that.so am planning to get username and password from user itself.
So i want to display input window for getting username and password(Is this possible to do in DLL).....Is there any way?
Thanks
Mohan t
|
|
|
|
|
How to keep wait cursor (AfxGetApp()->DoWaitCursor(1);) to remain wait cursor after the event handler (e.g. button click) ends?
If you start wait cursor in some button click even handler, then, when the handler ends, the cursor automatically returns to arrow.
I start some calculations in AfxThread() and I need the wait cursor to keep waiting until manualy reseted in another event handler.
Чесноков
|
|
|
|
|
Windows is constantly sending WM_SETCURSOR messages to the window under the mouse. The onlt reason CWaitCursor works is that while you're in an event handler, you're not pumping messages.
If you're doing the calculations in another thread, then your main thread is able to proceed quite happily, so the wait cursor would not be appropriate anyway!
You have a few choices.
1/ My favourite.
Provide a progress bar in your main thread, and a cancel button. As the calculate thread proceeds, post messages to the main thread, which will then update the process bar. But... if this was within your casual abilities [*], you would not be asking the question...
2/ Handle WM_SETCURSOR, and return differing values.
This is still not easy...
You need to set the view to use a window class with no default cursor:
BOOL CMyView::OnSetCursor( CWnd* pWnd, UINT nHitTest, UINT message )
{
if (m_bThreadRunning)
{
::SetCursor (::LoadCursor (NULL, IDC_WAIT));
return TRUE;
}
return FALSE;
}
How you set the m_bThreadRunning flag is another question. But you know when the thread starts, as you fire it yourself. And you must have some way of knowing when the calculations are done, or they're not much use to you!
3/
Well, there are many other ways, but a lot will depend on the nature of your application, which I can't see.
Good luck - you'll find many more problems with multithreading. It's very powerful, but hard. And pretty much expected from any modern program.
Iain.
[*] I'm not trying to be patronising. I have every confidence you will gain experience, and be able to do this stuff in your sleep.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need contract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
2) Is a good solution. And it worked.
But if the user clicked the button, and left mouse without movement during thread execution, upon termination of the thread there will be no WM_SETCURSOR events in that case.
How to return back to arrow in that case. We need to call explicitly OnSetCursor()? with which params?
I tried OnSetCursor(this, HTCLIENT, WM_MOUSEMOVE); those but the cursor still remains waiting.
Чесноков
|
|
|
|
|
Well, I set the cursor to the WAIT one, using SetCursor / LoadCursor. Look up the function for yourself, and the answer to your question will become obvious.
Iain.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need contract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
Hi
I am working with zooming the images , its almost done but i need little confusion with how to save the images from output form of ::StretchBlt()
this is my code snippet
CImage __ImageZoom,imgout;
CBitmap __cb;
__ImageZoom.Load(L"ZoomImage.TIF");
HDC hdc,hmemdc;
hdc = ::GetDC(NULL);
hmemdc = ::CreateCompatibleDC(hdc);
::SelectObject(hmemdc,(HBITMAP)__ImageZoom);
::StretchBlt(hdc,0,0,624,694,hmemdc,0,0,__ImageZoom.GetWidth(),__ImageZoom.GetHeight(),SRCCOPY);
imgout.BitBlt(hdc,0,694);
imgout.ReleaseDC();
imgout.Save(L"Sample.tif");
Thanks
|
|
|
|
|
raju_Code wrote: imgout.BitBlt(hdc,0,694);
imgout.ReleaseDC();
imgout.Save(L"Sample.tif");
I suppose you should use
imgout.Create(624, 694, __ImageZoom.getBPP());
__ImageZoom.StretchBlt(imgout.getDC(), 0, 0, 624, 694);
imgout.ReleaseDC();
imgout.Save(L"Sample.tif");
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
[My articles]
modified on Tuesday, September 29, 2009 5:05 AM
|
|
|
|
|
Thanks for your replay
when i add your function ..its throwing exception like
m_hBitmap!=0
|
|
|
|
|
You're right, I missed a step. Anyway I've fixed my previous answer, check it out.
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
[My articles]
|
|
|
|
|
Thanks mr.CPallini
i solved it ...
~~~~~~~~~~~~~Raju~~~~~~~~~~~~~
|
|
|
|
|
I have A Main Application . I have another second exe , that second exe will run using create
process() through main application by clicking on button . Is that possible I can run the second
exe on another computer in network as I click button on main Application
Trioum
|
|
|
|
|
Nope, not with CreateProcess.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
then how it is possible .tell me another procedure
Trioum
|
|
|
|
|
Hello!
Cannot figure this out for two days already...
Example:
Header file:
<br />
<br />
#pragma once<br />
#include "afxwin.h"<br />
#include "afxcmn.h"<br />
<br />
<br />
<br />
class CUsersForm : public CDialog<br />
{<br />
DECLARE_DYNAMIC(CUsersForm)<br />
<br />
public:<br />
CUsersForm(CWnd* pParent = NULL);
virtual ~CUsersForm();<br />
<br />
enum { IDD = IDD_USERS_FORM };<br />
<br />
protected:<br />
virtual void DoDataExchange(CDataExchange* pDX);
<br />
DECLARE_MESSAGE_MAP()<br />
public:<br />
<br />
afx_msg void OnBnClickedGendataButton();<br />
<br />
CWnd* GenDataButton;<br />
<br />
void InitDataFields(void);<br />
virtual BOOL OnInitDialog();<br />
};<br />
<br />
<br />
Code file:
<br />
#include "stdafx.h"<br />
#include "UsersForm.h"<br />
<br />
<br />
<br />
IMPLEMENT_DYNAMIC(CUsersForm, CDialog)<br />
<br />
CUsersForm::CUsersForm(CWnd* pParent )<br />
: CDialog(CUsersForm::IDD, pParent)<br />
{<br />
<br />
}<br />
<br />
CUsersForm::~CUsersForm()<br />
{<br />
}<br />
<br />
<br />
void CUsersForm::DoDataExchange(CDataExchange* pDX)<br />
{<br />
CDialog::DoDataExchange(pDX);<br />
}<br />
<br />
<br />
BEGIN_MESSAGE_MAP(CUsersForm, CDialog)<br />
ON_BN_CLICKED(IDC_GENDATA_BUTTON, &CUsersForm::OnBnClickedGendataButton)<br />
END_MESSAGE_MAP()<br />
<br />
void CUsersForm::OnBnClickedGendataButton()<br />
{ <br />
this->GenDataButton->ShowWindow(SW_HIDE);<br />
}<br />
<br />
<br />
BOOL CUsersForm::OnInitDialog()<br />
{<br />
CDialog::OnInitDialog();<br />
this->InitDataFields();<br />
return TRUE;
}<br />
<br />
void CUsersForm::InitDataFields(void)<br />
{<br />
this->GenDataButton = GetDlgItem(IDC_GENDATA_BUTTON);<br />
<br />
}
The point is - this is just a sample code. I need to create an array of pointers to dialog items (CWnd type) for later use in this class. How do i accomplish this?
Please at least point me to the right documentation about this issue.. Is this something with variable types (static etc)..
Thank`s
modified on Tuesday, September 29, 2009 7:12 AM
|
|
|
|
|
Makakuin wrote: void CUsersForm::InitDataFields(void)
{
this->GenDataButton = GetDlgItem(IDC_GENDATA_BUTTON)->m_hWnd;
//Debugging shows that GenDataButton is valid here.
}
GenDataButton is a CWnd*, not a HWND. So, write this instead:
this->GenDataButton = GetDlgItem(IDC_GENDATA_BUTTON);
|
|
|
|