How to send a message to dialogue class




 Hi,  

I am new to MFC, I am using a thread and want to send a message to dialogue class using that thread(ThreadProc) so i can call a function in the dialogue class using that thread. Please tell me the message code to use.(Sendmessage(?????????????))  

  

Think i need to send "ON\_CBN\_SELCHANGE" and id is "IDC\_PType" (Please read the code)  

Tanks  

Here is the code  

  


```
// UMKurunegalaDlg.cpp : implementation file
//

#include "stdafx.h"
#include "UMKurunegala.h"
#include "UMKurunegalaDlg.h"
#include "afxdialogex.h"



#ifdef \_DEBUG
#define new DEBUG\_NEW
#endif
static int Data\_Of\_Thread\_1 = 1;
static HANDLE Handle\_Of\_Thread = 0;
int val = 0;

void ThreadProc(void *param)// *** The thread i am using
{
    int h=*((int*)param);

	SendMessage(?????????????????????????????????????????????????????);
    
    \_endthread();
}
		/*DWORD WINAPI setBitThread(LPVOID lpParam) 
{ 
 CUMKurunegalaDlg::OnCbnEditchangePtype();
 return 0; 
} */

// CAboutDlg dialog used for App About

class CAboutDlg : public CDialogEx
{
public:
	CAboutDlg();

// Dialog Data
	enum { IDD = IDD\_ABOUTBOX };

	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support

// Implementation
protected:
	DECLARE\_MESSAGE\_MAP()
};

CAboutDlg::CAboutDlg() : CDialogEx(CAboutDlg::IDD)
{
}

void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
}

BEGIN\_MESSAGE\_MAP(CAboutDlg, CDialogEx)
END\_MESSAGE\_MAP()


// CUMKurunegalaDlg dialog




CUMKurunegalaDlg::CUMKurunegalaDlg(CWnd* pParent /*=NULL*/)
	: CDialogEx(CUMKurunegalaDlg::IDD, pParent)
{
	m\_hIcon = AfxGetApp()->LoadIcon(IDR\_MAINFRAME);
}

void CUMKurunegalaDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
	DDX\_Control(pDX, teststt, testt);
	DDX\_Control(pDX, IDC\_VType, vtypec);
	DDX\_Control(pDX, IDC\_pricest, pricest);
	DDX\_Control(pDX, IDC\_VBrand, vbrandc);
	DDX\_Control(pDX, IDC\_VModel, vmodelc);
	DDX\_Control(pDX, IDC\_VPart, vpartc);
	DDX\_Control(pDX, IDC\_PType, ptypec);

}

BEGIN\_MESSAGE\_MAP(CUMKurunegalaDlg, CDialogEx)
	ON\_WM\_SYSCOMMAND()
	ON\_WM\_PAINT()
	ON\_WM\_QUERYDRAGICON()
	ON\_CBN\_SELCHANGE(IDC\_VType, &CUMKurunegalaDlg::OnCbnSelchangeVtype)
	ON\_CBN\_SELCHANGE(IDC\_VBrand, &CUMKurunegalaDlg::OnCbnSelchangeVbrand)
	ON\_CBN\_SELCHANGE(IDC\_VModel, &CUMKurunegalaDlg::OnCbnSelchangeVmodel)
	ON\_CBN\_SELCHANGE(IDC\_VPart, &CUMKurunegalaDlg::OnCbnSelchangeVpart)
	ON\_CBN\_SELCHANGE(IDC\_PType, &CUMKurunegalaDlg::OnCbnSelchangePtype)
	ON\_CBN\_EDITCHANGE(IDC\_PType, &CUMKurunegalaDlg::OnCbnEditchangePtype)
	ON\_CBN\_CLOSEUP(IDC\_PType, &CUMKurunegalaDlg::OnCbnCloseupPtype)
END\_MESSAGE\_MAP()
```
I suggest to use PostThreadMessage instead of SendMessage, check [PostThreadMessage Demystified](http://www.codeproject.com/Articles/225755/PostThreadMessage-Demystified)[[^](http://www.codeproject.com/Articles/225755/PostThreadMessage-Demystified "New Window")] for reasons. For Documentation see <http://msdn.microsoft.com/en-us/library/windows/desktop/ms644946%28v=vs.85%29.aspx>[[^](http://msdn.microsoft.com/en-us/library/windows/desktop/ms644946%28v=vs.85%29.aspx "New Window")]  

  

And by the way if you want to invoke a function of your dialog class from your thread, then you need to send the "this"(present dialog object reference) as a parameter to the thread procedure. Are you sure you are doing this? Because in the code you are casting you lParam into an int which baffles me. When you call your threadproc you need to send "this" as "lParam".  

With SendMessage the code would look something like :   


```
 void ThreadProc(LPVOID lParam)
{
   CCurrentDialog* pDlg = (CCurrentDialog*)lParam;
   SendMessage(pDlg->m\_hWnd,ON\_CBN\_SELCHANGE,NULL,NULL);
}
```
  

  

You can use [PostMessage](http://msdn.microsoft.com/en-us/library/windows/desktop/ms644944%28v=vs.85%29.aspx)[[^](http://msdn.microsoft.com/en-us/library/windows/desktop/ms644944%28v=vs.85%29.aspx "New Window")] also.
can you be a little more precise ? does your send message work corretctly if sent from main procedure ? if yes do you uses qmhsndpm ? who is the receiver (call stack entry) (I suppose it’s ‘*’) ? what level in the stack (call stack count)(I suppose it’s 2 ) ?





A message subfile displays the messages from a program message queue — that’s what they’re for. Normally, they’re linked to the name of the program that displays the message subfile (i.e., displays the display file).


Send a message to the program message queue that’s associated with the message subfile.


Tom Please create an account and send us a private message with the detailed project requirements here -> <https://cpentalk.com/message/cpentalk>  
  
Best regards! Hi Romain, 

  
  
You can use HTML formatting this way:

  
  

```
  
sender = scenario.get_message_sender(channel_id="my_channel_id")   
sender.set_params(sender="dss@company.com",   
                recipient="your.email@company.com",   
                sendAsHTML=True)  
                  
html_message="<b>All is good</b>"  
  
sender.send(subject="The scenario is doing well",   
            message=html_message)
```
  
  
 




[View solution in original post](/t5/Using-Dataiku/Is-it-possible-to-send-custom-reports-as-HTML/m-p/2194#M1517) hi andy,  

  

could you please explain in more details what exactly you need to achieve, because i am still not sure i understand you correctly?  

  

please note that when you are using the code below, you are overriding the text of the selected item - in your case this is the first item in the radcombombobox(with the empty text):  


`ddlfuturecode.selecteditem.text =` `"futurecode"`

  

if you want to select an item from the radcombobox by its text, you can use the following code instead:  


`ddlfuturecode.finditembytext(``"futurecode"``).selected =` `true`

  

so the changed vb code should look like the following:  


`dim` `ddlfuturecode` `as` `new` `radcombobox`
 
`with` `ddlfuturecode`
`.items.clear()`
`.items.add(``new` `radcomboboxitem(``""``, 0))`
`.items.add(``new` `radcomboboxitem(``"1"``, 1))`
`.items.add(``new` `radcomboboxitem(``"futurecode"``, 2))`
`.databind()`
`end` `with`
 
`ddlfuturecode.finditembytext(``"futurecode"``).selected =` `true`
 
`form1.controls.add(ddlfuturecode)`

  

  

regards,  

 aneliya petkova   

telerik

do you want to have your say when we set our development plans?
do you want to know when a feature you care about is added or when a bug fixed?
explore the [telerik feedback portal](http://www.telerik.com/support/feedback)
and vote to affect the priority of the items hi eric, - - can you elaborate how you are getting a reference to the diagram? are you doing it in the way shown in the demo, in the diagram\_load() handler? the code below can be found in the scripts.js tab of this demo: - - var jsontextbox, diagram; -   -   function diagram\_load(sender) { -       diagram = sender.get\_kendowidget(); -   -       diagram.layout({ -           type: tree, -           subtype: left, -           roots: [diagram.getshapebyid(nadal\_winner)], -           verticalseparation: 20, -           horizontalseparation: 30 -       }); -   } - - - - - regards, - vessy - progress telerik - get quickly onboarded and successful with your telerik and/or kendo ui products with the virtual classroom free technical training, available to all active customers. learn more. Hello Dmytro,


You will need to bind to the Custom Command, create arguments for the command execution, specify parameter values that will be used to execute the command in the Scheduled Task and then pass the arguments to the Arguments property of the action. Here is the code that will do the trick:



```
# Define actions and conditions for the task

$commandID = "{a7264a61-b77d-4386-a138-ec2557c5b3ba}" # Command ID
$commandDN = "CN=MyCommand,CN=Custom Commands,CN=Configuration Objects,CN=Adaxes Configuration,CN=Adaxes" # Command DN

# Create action set
$actionsAndConditions = $task.ConditionedActions.Create()
$actionsAndConditions.ConditionsLogicalOperation = "ADM_LOGICALOPERATION_AND"
$actionsAndConditions.SetInfo()

# Create execute Custom Command action
$action = $actionsAndConditions.Actions.CreateEx("adm-CustomCommandAction")
$action.ExecutionOptions = "ADM_ACTIONEXECUTIONOPTIONS_SYNC"

# Get action
$removeAction = $action.GetAction()

# Bind to Custom Command
$customCommand = $Context.BindToObjectByDN($commandDN)

# Specify command arguments
$arguments = $customCommand.CreateArguments()
$arguments.SetParameterValue("MyParameter", "MyValue") # Parameter value

# Configure the action
$removeAction.CustomCommandId = $commandID
$removeAction.Arguments = $arguments

# Save action
$action.SetAction($removeAction)
$action.SetInfo()
```

In the script, the $commandDN variable specifies the distinguished name (DN) of the Custom Command. For information on how to get the DN of a directory object, see <http://adaxes.com/sdk/?HowDoI.GetDnOfObject.html>.


For details, have a look at the following SDK article: <http://adaxes.com/sdk/?IAdmCustomCommandAction2.html>. hi marko :slight\_smile: welcome to the community.

if you use multiple devices, it makes sense to enable “send copy to yourself” everywhere, so you see your own messages on all devices: <https://delta.chat/en/help#what-is-the-send-copy-to-self-setting-good-for>

ios often stops delta chat from running… hi [@prepetti](/u/prepetti),

try the send hotkey . it showing the context menu,

[image]

file : [excel.zip](https://aws1.discourse-cdn.com/uipath/original/3x/6/b/6b8e341a2c0952e41bb5c6738e513b77072e2268.zip) (1.7 kb)

regards

balamurugan. send me a message and i'll see what we can do for you.
 


  
 


 be sure to include a description of the issue, your username, and the error message you are prompted with when you attempt to create a ticket.
 


  
 


 received your message. topic locked. A couple of notes to get started:



> 
> .apply(literal\_eval)
> 
> 
> 


Wouldn't this be better as `map`?



> 
> I then re-create the Dask DF:
> 
> 
> ddf = dd.from\_pandas(ddf\_out, npartitions=nCores)
> 
> 
> 


`ddf_out` was already a dask dataframe, I don't know why you had to do this.



> 
> The columns in result seem to match those in metadir.
> 
> 
> 


The value of `result.columns` is taken from the meta you provided, no computing happens until you ask for it (dask is lazy in most operations). Does the ValueError exception not provide further information?


Here is a full example



```
x = ({'F9_07_PZ_COMP_DIRECT': '0',
  'F9_07_PZ_DIRTRSTKEY_NAME': 'DEBRA MEALY',
  'F9_07_PZ_COMP_OTHER': '0',
  'F9_07_PZ_COMP_RELATED': '0',
  'F9_07_PZ_TITLE': 'CHAIR PERSON',
  'F9_07_PZ_AVE_HOURS_WEEK': '1.00',
  'F9_07_PC_TRUSTEE_INDIVIDUAL': 'X'},
 {'F9_07_PZ_COMP_DIRECT': '0',
  'F9_07_PZ_DIRTRSTKEY_NAME': 'HELEN GORDON',
  'F9_07_PZ_COMP_OTHER': '0',
  'F9_07_PZ_COMP_RELATED': '0',
  'F9_07_PZ_TITLE': 'VICE CHAIR',
  'F9_07_PZ_AVE_HOURS_WEEK': '1.00',
  'F9_07_PC_TRUSTEE_INDIVIDUAL': 'X'})
df = pd.DataFrame({'a': x})
d = dd.from_pandas(df, 1)
meta = pd.DataFrame(columns=['F9_07_PZ_COMP_DIRECT', 
       'F9_07_PZ_DIRTRSTKEY_NAME',
       'F9_07_PZ_COMP_OTHER', 'F9_07_PZ_COMP_RELATED', 'F9_07_PZ_TITLE',
       'F9_07_PZ_AVE_HOURS_WEEK', 'F9_07_PC_TRUSTEE_INDIVIDUAL'], dtype="O")
d.map_partitions(lambda df: df.a.apply(pd.Series), meta=meta).compute()

```

How did I know what `meta` to use? I applied the function to the pandas dataframe - you might use a small piece of the dataframe to do this.


Some additional notes:


* it is an anti-pattern to load the data with pandas, pass to dask workers and then gather the whole result back to a pandas (in memory) dataframe, you are very unlikely to see a speedup this way and may incur a lot of overhead. You are better off loading with something like `dd.read_csv`, and aggregating or writing with dask functions too. Only `compute()` on something that will be small or not return anything (because it involves writing the output). The official examples do not use from\_pandas.
* string and dict processing are python methods, and so hold the interpreter lock (GIL) of any python function: threads will not actually run in parallel. To get parallelism, you need to run in processes, which is most easily achieved using <https://docs.dask.org/en/latest/setup/single-distributed.html>
* the distributed scheduler also gives you access to the dashboard, which has a lot of useful information to diagnose how your system is running. You can also configure a lot about its behaviour, in case you have firewall rules you need to obey.